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

More doc examples. #245

Merged
merged 6 commits into from Dec 9, 2016

Add doc examples for `Url::has_host`.

  • Loading branch information
frewsxcv committed Dec 9, 2016
commit cc3ca7b89f5efb520bdc6aae3c9863cd688fa123
@@ -595,6 +595,21 @@ impl Url {
}

/// Equivalent to `url.host().is_some()`.
///
/// # Examples
///
/// ```
/// use url::Url;
///
/// let url = Url::parse("ftp://rms@example.com").unwrap();
/// assert!(url.has_host());
///
/// let url = Url::parse("unix:/run/foo.socket").unwrap();
/// assert!(!url.has_host());
///
/// let url = Url::parse("data:text/plain,Stuff").unwrap();
/// assert!(!url.has_host());
/// ```
pub fn has_host(&self) -> bool {
!matches!(self.host, HostInternal::None)
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.