Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more doc examples. #212

Merged
merged 3 commits into from Aug 24, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add doc examples for `url::Url::password`.

  • Loading branch information
frewsxcv committed Aug 24, 2016
commit 1bee6e189ad0c502d7e7d43ff8ca081056a74269
@@ -475,6 +475,24 @@ impl Url {
}

/// Return the password for this URL, if any, as a percent-encoded ASCII string.
///
/// # Examples
///
/// ```
/// use url::Url;
///
/// let url = Url::parse("ftp://rms:secret123@example.com").unwrap();
/// assert_eq!(url.password(), Some("secret123"));
///
/// let url = Url::parse("ftp://:secret123@example.com").unwrap();
/// assert_eq!(url.password(), Some("secret123"));
///
/// let url = Url::parse("ftp://rms@example.com").unwrap();
/// assert_eq!(url.password(), None);
///
/// let url = Url::parse("https://example.com").unwrap();
/// assert_eq!(url.password(), None);
/// ```
pub fn password(&self) -> Option<&str> {
// This ':' is not the one marking a port number since a host can not be empty.
// (Except for file: URLs, which do not have port numbers.)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.