| ... | @@ -121,10 +121,6 @@ pub fn sliceToInt(comptime T: type, comptime E: type, slice: []const E) !T { | ... | @@ -121,10 +121,6 @@ pub fn sliceToInt(comptime T: type, comptime E: type, slice: []const E) !T { |
| 121 | return n; | 121 | return n; |
| 122 | } | 122 | } |
| 123 | | 123 | |
| 124 | pub fn FieldType(comptime T: type, comptime field: std.meta.FieldEnum(T)) type { | | |
| 125 | return std.meta.fieldInfo(T, field).type; | | |
| 126 | } | | |
| 127 | | | |
| 128 | pub fn fileList(alloc: std.mem.Allocator, dir: std.fs.IterableDir) ![]string { | 124 | pub fn fileList(alloc: std.mem.Allocator, dir: std.fs.IterableDir) ![]string { |
| 129 | var list = std.ArrayList(string).init(alloc); | 125 | var list = std.ArrayList(string).init(alloc); |
| 130 | defer list.deinit(); | 126 | defer list.deinit(); |
| ... | @@ -232,7 +228,7 @@ pub fn sortBy(comptime T: type, items: []T, comptime field: std.meta.FieldEnum(T | ... | @@ -232,7 +228,7 @@ pub fn sortBy(comptime T: type, items: []T, comptime field: std.meta.FieldEnum(T |
| 232 | pub fn sortBySlice(comptime T: type, items: []T, comptime field: std.meta.FieldEnum(T)) void { | 228 | pub fn sortBySlice(comptime T: type, items: []T, comptime field: std.meta.FieldEnum(T)) void { |
| 233 | std.sort.sort(T, items, {}, struct { | 229 | std.sort.sort(T, items, {}, struct { |
| 234 | fn f(_: void, lhs: T, rhs: T) bool { | 230 | fn f(_: void, lhs: T, rhs: T) bool { |
| 235 | return lessThanSlice(FieldType(T, field))({}, @field(lhs, @tagName(field)), @field(rhs, @tagName(field))); | 231 | return lessThanSlice(std.meta.FieldType(T, field))({}, @field(lhs, @tagName(field)), @field(rhs, @tagName(field))); |
| 236 | } | 232 | } |
| 237 | }.f); | 233 | }.f); |
| 238 | } | 234 | } |