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 a few doc examples. #228

Merged
merged 3 commits into from Nov 1, 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

Prev

Add doc example for url::Url::domain.

  • Loading branch information
frewsxcv committed Sep 30, 2016
commit 10ececb1be259ac8650a41ec351d284a32166b43
@@ -552,6 +552,18 @@ impl Url {
}

/// If this URL has a host and it is a domain name (not an IP address), return it.
///
/// # Examples
///
/// ```
/// use url::Url;
///
/// let url = Url::parse("https://127.0.0.1/").unwrap();
/// assert_eq!(url.domain(), None);
///
/// let url = Url::parse("https://example.com/").unwrap();
/// assert_eq!(url.domain(), Some("example.com"));
/// ```
pub fn domain(&self) -> Option<&str> {
match self.host {
HostInternal::Domain => Some(self.slice(self.host_start..self.host_end)),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.