URI
module URI
record URI
Strict RFC 3986 URI values, hierarchical URLs, query strings, and HTML form encoding. Parsing preserves caller spelling; normalization is always explicit.
using URI
let base = URL.parse("https://example.test/a/").try
let reference = URI.parse("../items?limit=10").try
base.resolve(reference).try.string
A parsed RFC 3986 URI reference. Construction is strict; use parse rather than building this representation directly. string preserves the spelling supplied by the caller, while normalize is explicit.
Fields
sourceString
Implements Showable, Inspectable.
Methods
resolve
resolve(reference: URI) -> Result<URI, URIError>
Resolves a URI reference against this absolute base.
inspectValue Inspectable
inspectValue(colors: Bool) -> String
Structural inspection is also credential-safe.
From Showable
record URL
An absolute hierarchical URI with an authority component.
Fields
sourceString
Implements Showable, Inspectable.
Methods
resolve
resolve(reference: URI) -> Result<URL, URIError>
Resolves a URI reference while preserving the URL invariant.
inspectValue Inspectable
inspectValue(colors: Bool) -> String
Structural inspection is also credential-safe.
From Showable
record Host
A host's display spelling and normalized ASCII/IDNA spelling.
Fields
record Query
Ordered URI query entries. None distinguishes a bare key from key=.
Fields
Methods
record Form
Ordered application/x-www-form-urlencoded entries.
Fields
Methods
record URIError
A typed URI parsing, conversion, or resolution failure.
Fields
kindURIErrorKindmessageStringpositionInteger?
type URIErrorKind
Stable URI failure categories.
Variants
InvalidSyntaxInvalidEscapeInvalidAuthorityInvalidPortNonASCIINotAbsoluteNotHierarchicalMissingAuthorityUnsupportedScheme