Function parse [src]
Parses the URI or returns an error.
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 {
var reader: SliceReader = .{ .slice = text };
const scheme = reader.readWhile(isSchemeChar);
// after the scheme, a ':' must appear
if (reader.get()) |c| {
if (c != ':')
return error.UnexpectedCharacter;
} else {
return error.InvalidFormat;
}
return parseAfterScheme(scheme, reader.readUntilEof());
}