url
URLs without a dependency: percent-encoding, query strings, a parser and reference resolution.
percent_encode / percent_decode handle one component, parse_query / build_query turn a query
string into pairs and back, join_path glues path pieces, and Url parses a whole URL (RFC 3986)
and resolves relative references against it. Malformed input is an error, never a silent fix.
Install
Section titled “Install”Cargo feature url (enabled by default). To compile only this module:
or in Cargo.toml:
Import path: helpers4::url.
| Item | What it does |
|---|---|
build_query | Builds a query string (a=1&b=two) from key-value pairs, percent-encoding both sides. |
join_path | Joins two pieces of a URL or path with exactly one / between them. |
parse_query | Parses a query string (a=1&b=two) into its key-value pairs, decoded, in order. |
Url | A parsed URL: scheme://userinfo@host:port/path?query#fragment. |
percent_decode | Decodes the %XX escapes of input. |
percent_encode | Percent-encodes input for use as one URL component: a path segment, a query key or value. |
Error types
Section titled “Error types”Documented on the page of the helper that returns them.
| Type | Returned by |
|---|---|
PercentDecodeError | parse_query, percent_decode |
UrlError | Url |
