Ver código fonte

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

Corey Farwell 10 anos atrás
pai
commit
28a7e7ab6a
1 arquivos alterados com 10 adições e 0 exclusões
  1. 10 0
      src/lib.rs

+ 10 - 0
src/lib.rs

@@ -289,6 +289,16 @@ impl Url {
     /// Return the serialization of this URL.
     /// Return the serialization of this URL.
     ///
     ///
     /// This consumes the `Url` and takes ownership of the `String` stored in it.
     /// 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]
     #[inline]
     pub fn into_string(self) -> String {
     pub fn into_string(self) -> String {
         self.serialization
         self.serialization