Sfoglia il codice sorgente

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

Corey Farwell 9 anni fa
parent
commit
e62dbb5194
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      src/lib.rs

+ 8 - 0
src/lib.rs

@@ -228,6 +228,14 @@ impl<'a> ParseOptions<'a> {
 
 impl Url {
     /// Parse an absolute URL from a string.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use url::Url;
+    ///
+    /// let url = Url::parse("https://example.net").unwrap();
+    /// ```
     #[inline]
     pub fn parse(input: &str) -> Result<Url, ::ParseError> {
         Url::options().parse(input)