Skip to content

URI

[Source]

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).

class val URI is
  Stringable box,
  Equatable[URI val] ref

Implements


Constructors

create

[Source]

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

Returns


Public fields

let scheme: (String val | None val)

[Source]


let authority: (URIAuthority val | None val)

[Source]


let path: String val

[Source]


let query: (String val | None val)

[Source]


let fragment: (String val | None val)

[Source]


Public Functions

string

[Source]

Reconstruct the full URI string per RFC 3986 section 5.3.

fun box string()
: String iso^

Returns


query_params

[Source]

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.

fun box query_params()
: (QueryParams val | None val)

Returns


eq

[Source]

Structural equality on percent-encoded components without normalization.

Use URIEquivalent for normalization-aware comparison.

fun box eq(
  that: URI box)
: Bool val

Parameters

  • that: URI box

Returns


ne

fun box ne(
  that: URI val)
: Bool val

Parameters

  • that: URI val

Returns