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
Prev

Add doc examples for `Url::host`.

  • Loading branch information
frewsxcv committed Dec 9, 2016
commit 4db9ecf1057d260a74bd90e381bfd3c358ace800
@@ -656,6 +656,24 @@ impl Url {
/// don’t have a host.
///
/// See also the `host_str` method.
///
/// # Examples
///
/// ```
/// use url::Url;
///
/// let url = Url::parse("https://127.0.0.1/index.html").unwrap();
/// assert!(url.host().is_some());
///
/// let url = Url::parse("ftp://rms@example.com").unwrap();
/// assert!(url.host().is_some());
///
/// let url = Url::parse("unix:/run/foo.socket").unwrap();
/// assert!(url.host().is_none());
///
/// let url = Url::parse("data:text/plain,Stuff").unwrap();
/// assert!(url.host().is_none());
/// ```
pub fn host(&self) -> Option<Host<&str>> {
match self.host {
HostInternal::None => None,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.