authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-05 13:25:18 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-07-05 13:25:18 -07:00
logf7122c1dce069c5cc08288c0b066ebdac0d9a4aa
treee28c0cbdb9628d4b839902eb993e39cd150fbbf4
parent512638d169b5fb13b4ac023b03f20c777a42f38f

FieldType got upstreamed


1 files changed, 1 insertions(+), 5 deletions(-)

src/lib.zig+1-5
...@@ -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}
123123
124pub fn FieldType(comptime T: type, comptime field: std.meta.FieldEnum(T)) type {
125 return std.meta.fieldInfo(T, field).type;
126}
127
128pub fn fileList(alloc: std.mem.Allocator, dir: std.fs.IterableDir) ![]string {124pub 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
232pub fn sortBySlice(comptime T: type, items: []T, comptime field: std.meta.FieldEnum(T)) void {228pub 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}