Function doh::util::parent_url
[−]
[src]
pub fn parent_url(u: &Url) -> Url
Get a URL that is canonically considered a "parent" to the specified one, or the specified URL if it is a root URL.
Examples
assert_eq!(parent_url(&"https://google.com/search/capitalism/".parse().unwrap()), "https://google.com/search".parse().unwrap()); assert_eq!(parent_url(&"https://google.com/search".parse().unwrap()), "https://google.com".parse().unwrap()); assert_eq!(parent_url(&"https://google.com".parse().unwrap()), "https://google.com".parse().unwrap());