Expand description
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"));
Modules§
- form_
urlencoded - Parser and serializer for the
application/x-www-form-urlencoded
syntax, as used by HTML forms.
Structs§
- Opaque
Origin - Opaque identifier for URLs that have file or other schemes
- Parse
Options - Full configuration for the URL parser.
- Path
Segments Mut - Exposes methods to manipulate the path of an URL that is not cannot-be-base.
- Url
- A parsed URL record.
- UrlQuery
- Implementation detail of
Url::query_pairs_mut
. Typically not used directly.
Enums§
- Host
- The host name of an URL.
- Origin
- The origin of an URL
- Parse
Error - Errors that can occur during parsing.
- Position
- Indicates a position within a URL based on its components.
- Syntax
Violation - Non-fatal syntax violations that can occur during parsing.