DoxigAlpha

parse

The return value will contain strings pointing into the original text. Each component that is provided will be non-null.

Function parameters

Parameters

#
text:[]const u8

Type definitions in this namespace

Types

#

Returned value may point into `buffer` or be the original string.

Functions

#
getHost
Returned value may point into `buffer` or be the original string.
getHostAlloc
Returned value may point into `buffer` or be the original string.
percentDecodeBackwards
Percent decodes all %XX where XX is a valid hex number.
percentDecodeInPlace
Percent decodes all %XX where XX is a valid hex number.
parseAfterScheme
Parses the URI or returns an error.
parse
The return value will contain strings pointing into the original `text`.
resolveInPlace
Resolves a URI against a base URI, conforming to

Error sets in this namespace

Error Sets

#

= 255

Values

#

Source

Implementation

#
pub fn parse(text: []const u8) ParseError!Uri {
    const end = for (text, 0..) |byte, i| {
        if (!isSchemeChar(byte)) break i;
    } else text.len;
    // After the scheme, a ':' must appear.
    if (end >= text.len) return error.InvalidFormat;
    if (text[end] != ':') return error.UnexpectedCharacter;
    return parseAfterScheme(text[0..end], text[end + 1 ..]);
}