|
|
@@ -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':');
|