| ... | @@ -55,7 +55,7 @@ test "std.meta.tagName" { | ... | @@ -55,7 +55,7 @@ test "std.meta.tagName" { |
| 55 | pub fn stringToEnum(comptime T: type, str: []const u8) ?T { | 55 | pub fn stringToEnum(comptime T: type, str: []const u8) ?T { |
| 56 | // Using ComptimeStringMap here is more performant, but it will start to take too | 56 | // Using ComptimeStringMap here is more performant, but it will start to take too |
| 57 | // long to compile if the enum is large enough, due to the current limits of comptime | 57 | // long to compile if the enum is large enough, due to the current limits of comptime |
| 58 | 	// performance when doing things like constructing lookup maps at comptime. | 58 | // performance when doing things like constructing lookup maps at comptime. |
| 59 | // TODO The '100' here is arbitrary and should be increased when possible: | 59 | // TODO The '100' here is arbitrary and should be increased when possible: |
| 60 | // - https://github.com/ziglang/zig/issues/4055 | 60 | // - https://github.com/ziglang/zig/issues/4055 |
| 61 | // - https://github.com/ziglang/zig/issues/3863 | 61 | // - https://github.com/ziglang/zig/issues/3863 |
| ... | @@ -70,7 +70,7 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T { | ... | @@ -70,7 +70,7 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T { |
| 70 | }; | 70 | }; |
| 71 | var kvs_array: [@typeInfo(T).Enum.fields.len]EnumKV = undefined; | 71 | var kvs_array: [@typeInfo(T).Enum.fields.len]EnumKV = undefined; |
| 72 | inline for (@typeInfo(T).Enum.fields) |enumField, i| { | 72 | inline for (@typeInfo(T).Enum.fields) |enumField, i| { |
| 73 | kvs_array[i] = .{.@"0" = enumField.name, .@"1" = @field(T, enumField.name)}; | 73 | kvs_array[i] = .{ .@"0" = enumField.name, .@"1" = @field(T, enumField.name) }; |
| 74 | } | 74 | } |
| 75 | break :build_kvs kvs_array[0..]; | 75 | break :build_kvs kvs_array[0..]; |
| 76 | }; | 76 | }; |