Module url

URL parsing and manipulation.


url implements the WHATWG URL Standard for parsing and manipulating URLs. It provides a robust, spec-compliant URL parser that handles all the edge cases of URL parsing, including internationalized domain names, percent encoding, and proper handling of relative URLs.

Examples

Basic URL parsing and components:

use url::Url;

let parsed = Url::parse("https://example.com:8080/path?query=value#fragment").unwrap();
assert_eq!(parsed.scheme(), "https");
assert_eq!(parsed.host_str(), Some("example.com"));
assert_eq!(parsed.port(), Some(8080));
assert_eq!(parsed.path(), "/path");
assert_eq!(parsed.query(), Some("query=value"));
assert_eq!(parsed.fragment(), Some("fragment"));

Structs