Просмотр исходного кода

Add another `url::Url::username` doc example.

Corey Farwell 10 лет назад
Родитель
Сommit
80c0c4889e
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      src/lib.rs

+ 3 - 0
src/lib.rs

@@ -460,6 +460,9 @@ impl Url {
     /// let url = Url::parse("ftp://rms@example.com").unwrap();
     /// assert_eq!(url.username(), "rms");
     ///
+    /// let url = Url::parse("ftp://:secret123@example.com").unwrap();
+    /// assert_eq!(url.username(), "");
+    ///
     /// let url = Url::parse("https://example.com").unwrap();
     /// assert_eq!(url.username(), "");
     /// ```