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::cannot_be_a_base`.

  • Loading branch information
frewsxcv committed Dec 9, 2016
commit 7f539c6c41bae8b98b15f3c2941c8793abc6b1af
@@ -519,6 +519,21 @@ impl Url {
///
/// This is the case if the scheme and `:` delimiter are not followed by a `/` slash,
/// as is typically the case of `data:` and `mailto:` URLs.
///
/// # Examples
///
/// ```
/// use url::Url;
///
/// let url = Url::parse("ftp://rms@example.com").unwrap();
/// assert!(!url.cannot_be_a_base());
///
/// let url = Url::parse("unix:/run/foo.socket").unwrap();
/// assert!(!url.cannot_be_a_base());
///
/// let url = Url::parse("data:text/plain,Stuff").unwrap();
/// assert!(url.cannot_be_a_base());
/// ```
#[inline]
pub fn cannot_be_a_base(&self) -> bool {
!self.slice(self.path_start..).starts_with('/')
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.