std.uri
This module provides types for working with RFC 3986/3987 compliant URIs. For
example, parsing of URIs is done using Uri.parse:
import std.uri (Uri)
let uri = Uri
.parse('https://example.com/hello.html?key=value')
.or_panic
uri.scheme # => Option.Some(Scheme.Https)
For more information, refer to the documentation of the Uri type.
Internationalized resource identifiers
This module includes support for international URIs as defined in RFC 3987. Unlike this RFC we don't limit ourselves to the Unicode blocks listed in the RFC, instead allowing all of the Unicode specification (provided the byte sequences translate to valid Unicode characters). This means our parser is a bit more lenient compared to RFC 3987, but in exchange the code is simpler, more future proof and faster (compared to iterating over UTF-8 codepoints).
When normalizing an international URI, multi-byte character sequences are not converted to their lowercase equivalent due to this being locale specific.
Methods
| decode | Percent decodes a | |
| encode | Percent encodes a |
Types
| Error | An error produced while parsing a URI. | |
| Fragment | The fragment string of a URI. | |
| Host | A named host or IP address. | |
| Path | The path of a URI. | |
| PathComponents | An iterator over the components in a | |
| Query | A (optionally) percent-encoded query string. | |
| QueryValue | ||
| Scheme | The scheme of a URI. | |
| Uri | A Unicode aware Uniform Resource Identifier. | |
| UserInfo | A username and an optional password. | |
| Values | A mapping of URI/percent-encoded key-value pairs. |