Function parse [src]
The return value will contain strings pointing into the original text.
Each component that is provided will be non-null.
Prototype
pub fn parse(text: []const u8) ParseError!Uri
Parameters
text: []const u8
Possible Errors
Source
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 ..]);
}