cheatah
Class

parsers::url::Parser

The URL parser.

Stateless and reusable; a class (not a free function) so the module surface is symmetric with parsers::json::Parser and imports the same way from cheatah.

Functions

fn bool parse(std::string_view text, Url &out) const source#

Parse text into out.

Accepts scheme://host[:port][/path][?query] with scheme http or https (case-insensitive). Rejects empty hosts, non-numeric or out-of-range ports, userinfo, and fragments. On failure out is left unspecified.

Parameters
text

the URL text to parse.

out

receives the parsed components on success.

Returns

true iff text is a valid accepted URL.

Complexity

O(|text|)

Allocation

the component strings in out

Unit testUrlParser.Components