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_authority`.

  • Loading branch information
frewsxcv committed Dec 9, 2016
commit 144467f800bc7651a8b211975e90c57964a0584f
@@ -493,6 +493,21 @@ impl Url {
///
/// URLs that do *not* are either path-only like `unix:/run/foo.socket`
/// or cannot-be-a-base like `data:text/plain,Stuff`.
///
/// # Examples
///
/// ```
/// use url::Url;
///
/// let url = Url::parse("ftp://rms@example.com").unwrap();
/// assert!(url.has_authority());
///
/// let url = Url::parse("unix:/run/foo.socket").unwrap();
/// assert!(!url.has_authority());
///
/// let url = Url::parse("data:text/plain,Stuff").unwrap();
/// assert!(!url.has_authority());
/// ```
#[inline]
pub fn has_authority(&self) -> bool {
debug_assert!(self.byte_at(self.scheme_end) == b':');
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.