| ... | @@ -47,7 +47,7 @@ pub const URL = struct { | ... | @@ -47,7 +47,7 @@ pub const URL = struct { |
| 47 | // input is a scalar value string | 47 | // input is a scalar value string |
| 48 | if (!std.unicode.utf8ValidateSlice(input)) return error.InvalidURL; | 48 | if (!std.unicode.utf8ValidateSlice(input)) return error.InvalidURL; |
| 49 | | 49 | |
| 50 | var inputl = std.ArrayList(u8).init(alloc); | 50 | var inputl = std.array_list.Managed(u8).init(alloc); |
| 51 | defer inputl.deinit(); | 51 | defer inputl.deinit(); |
| 52 | try inputl.appendSlice(input); | 52 | try inputl.appendSlice(input); |
| 53 | | 53 | |
| ... | @@ -70,7 +70,7 @@ pub const URL = struct { | ... | @@ -70,7 +70,7 @@ pub const URL = struct { |
| 70 | // we always do utf-8 | 70 | // we always do utf-8 |
| 71 | | 71 | |
| 72 | // 6. | 72 | // 6. |
| 73 | var buffer = std.ArrayList(u8).init(alloc); | 73 | var buffer = std.array_list.Managed(u8).init(alloc); |
| 74 | defer buffer.deinit(); | 74 | defer buffer.deinit(); |
| 75 | | 75 | |
| 76 | // 7. | 76 | // 7. |
| ... | @@ -1138,9 +1138,9 @@ pub const SearchParams = struct { | ... | @@ -1138,9 +1138,9 @@ pub const SearchParams = struct { |
| 1138 | return self.inner.len; | 1138 | return self.inner.len; |
| 1139 | } | 1139 | } |
| 1140 | | 1140 | |
| 1141 | pub fn encode(self: *const SearchParams) !string { | 1141 | pub fn encode(self: *const SearchParams) ![]u8 { |
| 1142 | const alloc = self.allocator; | 1142 | const alloc = self.allocator; |
| 1143 | var list = std.ArrayList(u8).init(alloc); | 1143 | var list = std.array_list.Managed(u8).init(alloc); |
| 1144 | errdefer list.deinit(); | 1144 | errdefer list.deinit(); |
| 1145 | for (self.inner.items(.key), self.inner.items(.value), 0..) |k, v, i| { | 1145 | for (self.inner.items(.key), self.inner.items(.value), 0..) |k, v, i| { |
| 1146 | if (i > 0) try list.writer().writeAll("&"); | 1146 | if (i > 0) try list.writer().writeAll("&"); |
| ... | @@ -1458,7 +1458,7 @@ fn parseHostOpaque(allocator: std.mem.Allocator, input: []const u8) ![]const u8 | ... | @@ -1458,7 +1458,7 @@ fn parseHostOpaque(allocator: std.mem.Allocator, input: []const u8) ![]const u8 |
| 1458 | /// https://url.spec.whatwg.org/#utf-8-percent-encode | 1458 | /// https://url.spec.whatwg.org/#utf-8-percent-encode |
| 1459 | fn percentEncode(allocator: std.mem.Allocator, input: []const u8, comptime set: fn (u8) bool) ![]u8 { | 1459 | fn percentEncode(allocator: std.mem.Allocator, input: []const u8, comptime set: fn (u8) bool) ![]u8 { |
| 1460 | if (!extras.matchesAny(u8, input, set)) return allocator.dupe(u8, input); | 1460 | if (!extras.matchesAny(u8, input, set)) return allocator.dupe(u8, input); |
| 1461 | var result = std.ArrayList(u8).init(allocator); | 1461 | var result = std.array_list.Managed(u8).init(allocator); |
| 1462 | errdefer result.deinit(); | 1462 | errdefer result.deinit(); |
| 1463 | try result.ensureUnusedCapacity(input.len); | 1463 | try result.ensureUnusedCapacity(input.len); |
| 1464 | try percentEncodeAL(&result, input, set); | 1464 | try percentEncodeAL(&result, input, set); |
| ... | @@ -1467,7 +1467,7 @@ fn percentEncode(allocator: std.mem.Allocator, input: []const u8, comptime set: | ... | @@ -1467,7 +1467,7 @@ fn percentEncode(allocator: std.mem.Allocator, input: []const u8, comptime set: |
| 1467 | | 1467 | |
| 1468 | /// https://url.spec.whatwg.org/#string-percent-decode | 1468 | /// https://url.spec.whatwg.org/#string-percent-decode |
| 1469 | pub fn percentDecode(allocator: std.mem.Allocator, input: []const u8) ![]u8 { | 1469 | pub fn percentDecode(allocator: std.mem.Allocator, input: []const u8) ![]u8 { |
| 1470 | var result = std.ArrayList(u8).init(allocator); | 1470 | var result = std.array_list.Managed(u8).init(allocator); |
| 1471 | errdefer result.deinit(); | 1471 | errdefer result.deinit(); |
| 1472 | try result.ensureUnusedCapacity(input.len); | 1472 | try result.ensureUnusedCapacity(input.len); |
| 1473 | try percentDecodeW(result.writer(), input); | 1473 | try percentDecodeW(result.writer(), input); |
| ... | @@ -1792,7 +1792,7 @@ fn lastcpi(haystack: []const u8) usize { | ... | @@ -1792,7 +1792,7 @@ fn lastcpi(haystack: []const u8) usize { |
| 1792 | while (haystack[i] & 0xC0 == 0x80) : (i -= 1) {} | 1792 | while (haystack[i] & 0xC0 == 0x80) : (i -= 1) {} |
| 1793 | return i; | 1793 | return i; |
| 1794 | } | 1794 | } |
| 1795 | pub fn percentEncodeScalarAL(list: *std.ArrayList(u8), cp: []const u8, comptime set: fn (u8) bool) !void { | 1795 | pub fn percentEncodeScalarAL(list: *std.array_list.Managed(u8), cp: []const u8, comptime set: fn (u8) bool) !void { |
| 1796 | if (set(cp[0])) { | 1796 | if (set(cp[0])) { |
| 1797 | for (cp) |b| { | 1797 | for (cp) |b| { |
| 1798 | try list.append('%'); | 1798 | try list.append('%'); |
| ... | @@ -1815,7 +1815,7 @@ pub fn percentEncodeW(writer: anytype, input: []const u8, comptime set: fn (u8) | ... | @@ -1815,7 +1815,7 @@ pub fn percentEncodeW(writer: anytype, input: []const u8, comptime set: fn (u8) |
| 1815 | } | 1815 | } |
| 1816 | } | 1816 | } |
| 1817 | } | 1817 | } |
| 1818 | pub fn percentEncodeAL(list: *std.ArrayList(u8), input: []const u8, comptime set: fn (u8) bool) !void { | 1818 | pub fn percentEncodeAL(list: *std.array_list.Managed(u8), input: []const u8, comptime set: fn (u8) bool) !void { |
| 1819 | var it = std.unicode.Utf8View.initUnchecked(input).iterator(); | 1819 | var it = std.unicode.Utf8View.initUnchecked(input).iterator(); |
| 1820 | while (it.nextCodepointSlice()) |sl| { | 1820 | while (it.nextCodepointSlice()) |sl| { |
| 1821 | if (set(sl[0])) { | 1821 | if (set(sl[0])) { |
| ... | @@ -1927,7 +1927,7 @@ fn nthScalarItem(T: type, haystack: []const u8, needle: T, index: usize) []const | ... | @@ -1927,7 +1927,7 @@ fn nthScalarItem(T: type, haystack: []const u8, needle: T, index: usize) []const |
| 1927 | | 1927 | |
| 1928 | pub fn ManyArrayList(N: usize, T: type) type { | 1928 | pub fn ManyArrayList(N: usize, T: type) type { |
| 1929 | return struct { | 1929 | return struct { |
| 1930 | list: std.ArrayList(T), | 1930 | list: std.array_list.Managed(T), |
| 1931 | lengths: [N]usize, | 1931 | lengths: [N]usize, |
| 1932 | | 1932 | |
| 1933 | pub fn init(allocator: std.mem.Allocator) @This() { | 1933 | pub fn init(allocator: std.mem.Allocator) @This() { |