Procházet zdrojové kódy

Add doc example for `url::Url::scheme`.

Corey Farwell před 10 roky
rodič
revize
1475ea889a
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  1. 9 0
      src/lib.rs

+ 9 - 0
src/lib.rs

@@ -423,6 +423,15 @@ impl Url {
     }
 
     /// Return the scheme of this URL, lower-cased, as an ASCII string without the ':' delimiter.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use url::Url;
+    ///
+    /// let url = Url::parse("file:///tmp/foo").unwrap();
+    /// assert_eq!(url.scheme(), "file");
+    /// ```
     #[inline]
     pub fn scheme(&self) -> &str {
         self.slice(..self.scheme_end)