URI¶
A parsed RFC 3986 URI-reference.
Components are stored in their percent-encoded form as they appeared in
the input. Delimiter characters (: after scheme, // before authority,
? before query, # before fragment) are stripped — use string() to
reconstruct the full URI with delimiters.
string() reconstruction follows RFC 3986 section 5.3. Components that
are None are omitted entirely (no delimiter). A component that is an
empty String (present but empty) includes its delimiter — e.g.,
query of "" produces a trailing ? with no value. This distinction
allows faithful reconstruction of inputs like http://example.com/path?
(empty query present, query = "") vs. http://example.com/path
(no query at all, query = None).
Equality is structural: two URIs are equal when all their stored
(percent-encoded) components are equal. No normalization is applied
before comparison. Use URIEquivalent for normalization-aware
comparison (RFC 3986 section 6).
Implements¶
- Stringable box
- Equatable[URI val] ref
Constructors¶
create¶
Build a URI from pre-encoded components.
All string values must already be percent-encoded as appropriate for
their component — no encoding is applied here. Most callers will obtain
a URI from ParseURI rather than constructing one directly.
new val create(
scheme': (String val | None val),
authority': (URIAuthority val | None val),
path': String val,
query': (String val | None val),
fragment': (String val | None val))
: URI val^
Parameters¶
- scheme': (String val | None val)
- authority': (URIAuthority val | None val)
- path': String val
- query': (String val | None val)
- fragment': (String val | None val)
Returns¶
- URI val^
Public fields¶
let scheme: (String val | None val)¶
let authority: (URIAuthority val | None val)¶
let path: String val¶
let query: (String val | None val)¶
let fragment: (String val | None val)¶
Public Functions¶
string¶
Reconstruct the full URI string per RFC 3986 section 5.3.
Returns¶
- String iso^
query_params¶
Parse the query string into a QueryParams collection.
Returns the parsed parameters if the query is present and decodes
successfully, or None if no query is present or if the query
contains invalid percent-encoding. For fine-grained error handling
(distinguishing "no query" from "decode failure"), use
ParseQueryParameters directly on the query field.
Returns¶
- (QueryParams val | None val)
eq¶
Structural equality on percent-encoded components without normalization.
Use URIEquivalent for normalization-aware comparison.
Parameters¶
- that: URI box
Returns¶
- Bool val
ne¶
Parameters¶
- that: URI val
Returns¶
- Bool val