11//! Implements URI parsing roughly adhering to <https://tools.ietf.org/html/rfc3986>.
22//! Does not do perfect grammar and character class checking, but should be robust against URIs in the wild.
33
4- const Url = @This ();
4+ const Uri = @This ();
55const std = @import ("std.zig" );
66const testing = std .testing ;
77
@@ -97,8 +97,8 @@ pub const ParseError = error{ UnexpectedCharacter, InvalidFormat, InvalidPort };
9797/// Parses the URI or returns an error.
9898/// The return value will contain unescaped strings pointing into the
9999/// original `text`. Each component that is provided, will be non-`null`.
100- pub fn parse (text : []const u8 ) ParseError ! Url {
101- var uri = Url {
100+ pub fn parse (text : []const u8 ) ParseError ! Uri {
101+ var uri = Uri {
102102 .scheme = null ,
103103 .user = null ,
104104 .password = null ,
@@ -311,7 +311,7 @@ test "with port" {
311311}
312312
313313test "should fail gracefully" {
314- try std .testing .expectEqual (@as (ParseError ! Url , error .InvalidFormat ), parse ("foobar://" ));
314+ try std .testing .expectEqual (@as (ParseError ! Uri , error .InvalidFormat ), parse ("foobar://" ));
315315}
316316
317317test "scheme" {
@@ -413,7 +413,7 @@ test "authority.IPv6" {
413413
414414test "RFC example 1" {
415415 const uri = "foo://example.com:8042/over/there?name=ferret#nose" ;
416- try std .testing .expectEqual (Url {
416+ try std .testing .expectEqual (Uri {
417417 .scheme = uri [0.. 3],
418418 .user = null ,
419419 .password = null ,
@@ -427,7 +427,7 @@ test "RFC example 1" {
427427
428428test "RFX example 2" {
429429 const uri = "urn:example:animal:ferret:nose" ;
430- try std .testing .expectEqual (Url {
430+ try std .testing .expectEqual (Uri {
431431 .scheme = uri [0.. 3],
432432 .user = null ,
433433 .password = null ,
0 commit comments