Skip to content

Commit 88826bd

Browse files
Update Url::domain docs to show that it includes subdomain (#1057)
* Update `Url::domain` docs to show that it includes subdomain Signed-off-by: supercoolspy <[email protected]> * Add subdomain example for `Url::host_str` Signed-off-by: supercoolspy <[email protected]> --------- Signed-off-by: supercoolspy <[email protected]> Co-authored-by: Manish Goregaokar <[email protected]>
1 parent c3bbf66 commit 88826bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

url/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,9 @@ impl Url {
11441144
/// let url = Url::parse("https://127.0.0.1/index.html")?;
11451145
/// assert_eq!(url.host_str(), Some("127.0.0.1"));
11461146
///
1147+
/// let url = Url::parse("https://subdomain.example.com")?;
1148+
/// assert_eq!(url.host_str(), Some("subdomain.example.com"));
1149+
///
11471150
/// let url = Url::parse("ftp://[email protected]")?;
11481151
/// assert_eq!(url.host_str(), Some("example.com"));
11491152
///
@@ -1223,6 +1226,10 @@ impl Url {
12231226
///
12241227
/// let url = Url::parse("https://example.com/")?;
12251228
/// assert_eq!(url.domain(), Some("example.com"));
1229+
///
1230+
/// let url = Url::parse("https://subdomain.example.com/")?;
1231+
/// assert_eq!(url.domain(), Some("subdomain.example.com"));
1232+
///
12261233
/// # Ok(())
12271234
/// # }
12281235
/// # run().unwrap();

0 commit comments

Comments
 (0)