| ... | @@ -330,15 +330,12 @@ pub const Utf8View = struct { | ... | @@ -330,15 +330,12 @@ pub const Utf8View = struct { |
| 330 | return Utf8View{ .bytes = s }; | 330 | return Utf8View{ .bytes = s }; |
| 331 | } | 331 | } |
| 332 | | 332 | |
| 333 | /// TODO: https://github.com/ziglang/zig/issues/425 | 333 | pub inline fn initComptime(comptime s: []const u8) Utf8View { |
| 334 | pub fn initComptime(comptime s: []const u8) Utf8View { | 334 | return comptime if (init(s)) |r| r else |err| switch (err) { |
| 335 | if (comptime init(s)) |r| { | | |
| 336 | return r; | | |
| 337 | } else |err| switch (err) { | | |
| 338 | error.InvalidUtf8 => { | 335 | error.InvalidUtf8 => { |
| 339 | @compileError("invalid utf8"); | 336 | @compileError("invalid utf8"); |
| 340 | }, | 337 | }, |
| 341 | } | 338 | }; |
| 342 | } | 339 | } |
| 343 | | 340 | |
| 344 | pub fn iterator(s: Utf8View) Utf8Iterator { | 341 | pub fn iterator(s: Utf8View) Utf8Iterator { |