Parcourir la source

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

Corey Farwell il y a 10 ans
Parent
commit
28a7e7ab6a
1 fichiers modifiés avec 10 ajouts et 0 suppressions
  1. 10 0
      src/lib.rs

+ 10 - 0
src/lib.rs

@@ -289,6 +289,16 @@ impl Url {
     /// Return the serialization of this URL.
     ///
     /// This consumes the `Url` and takes ownership of the `String` stored in it.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use url::Url;
+    ///
+    /// let url_str = "https://example.net/";
+    /// let url = Url::parse(url_str).unwrap();
+    /// assert_eq!(url.into_string(), url_str);
+    /// ```
     #[inline]
     pub fn into_string(self) -> String {
         self.serialization