From 3dfc08f917e25c4f0bc3de692326419e8193827a Mon Sep 17 00:00:00 2001 From: supercoolspy <66487448+supercoolspy@users.noreply.github.com> Date: Fri, 18 Jul 2025 17:53:19 -0700 Subject: [PATCH 1/2] Update `Url::domain` docs to show that it includes subdomain Signed-off-by: supercoolspy <66487448+supercoolspy@users.noreply.github.com> --- url/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/url/src/lib.rs b/url/src/lib.rs index 3a3c9c14..d539aa3a 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -1223,6 +1223,10 @@ impl Url { /// /// let url = Url::parse("https://example.com/")?; /// assert_eq!(url.domain(), Some("example.com")); + /// + /// let url = Url::parse("https://subdomain.example.com/")?; + /// assert_eq!(url.domain(), Some("subdomain.example.com")); + /// /// # Ok(()) /// # } /// # run().unwrap(); From 5504584ed1b1aa1a291c9e563a83e4b7cdd6c2eb Mon Sep 17 00:00:00 2001 From: supercoolspy <66487448+supercoolspy@users.noreply.github.com> Date: Fri, 18 Jul 2025 21:23:58 -0700 Subject: [PATCH 2/2] Add subdomain example for `Url::host_str` Signed-off-by: supercoolspy <66487448+supercoolspy@users.noreply.github.com> --- url/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/url/src/lib.rs b/url/src/lib.rs index d539aa3a..f139c2fb 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -1144,6 +1144,9 @@ impl Url { /// let url = Url::parse("https://127.0.0.1/index.html")?; /// assert_eq!(url.host_str(), Some("127.0.0.1")); /// + /// let url = Url::parse("https://subdomain.example.com")?; + /// assert_eq!(url.host_str(), Some("subdomain.example.com")); + /// /// let url = Url::parse("ftp://rms@example.com")?; /// assert_eq!(url.host_str(), Some("example.com")); ///