| author | |
| committer | |
| log | ffadb1f7fe4ed9a716570196adeaad3bb63d8c89 |
| tree | 673887d1ac6d900c4a1d9f44f912077583c5e507 |
| parent | ff047c05bdd2825e9964875c6b29fa3bf4461a79 |
| signature |
2 files changed, 3 insertions(+), 5 deletions(-)
src/fmtByteCountIEC.zig+2-4| ... | ... | @@ -3,13 +3,11 @@ const string = []const u8; |
| 3 | 3 | const extras = @import("./lib.zig"); |
| 4 | 4 | const reduceNumber = extras.reduceNumber; |
| 5 | 5 | |
| 6 | pub fn fmtByteCountIEC(b: u64) std.fmt.Formatter(formatByteCountIEC) { | |
| 6 | pub fn fmtByteCountIEC(b: u64) std.fmt.Alt(u64, formatByteCountIEC) { | |
| 7 | 7 | return .{ .data = b }; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | fn formatByteCountIEC(bytes: u64, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { | |
| 11 | _ = fmt; | |
| 12 | _ = options; | |
| 10 | fn formatByteCountIEC(bytes: u64, writer: *std.Io.Writer) !void { | |
| 13 | 11 | try reduceNumber(writer, bytes, 1024, "B", "KMGTPEZYRQ"); |
| 14 | 12 | } |
| 15 | 13 |
src/sortBySlice.zig+1-1| ... | ... | @@ -6,7 +6,7 @@ const lessThanSlice = extras.lessThanSlice; |
| 6 | 6 | pub fn sortBySlice(comptime T: type, items: []T, comptime field: std.meta.FieldEnum(T)) void { |
| 7 | 7 | std.mem.sort(T, items, {}, struct { |
| 8 | 8 | fn f(_: void, lhs: T, rhs: T) bool { |
| 9 | return lessThanSlice(std.meta.FieldType(T, field))({}, @field(lhs, @tagName(field)), @field(rhs, @tagName(field))); | |
| 9 | return lessThanSlice(@FieldType(T, @tagName(field)))({}, @field(lhs, @tagName(field)), @field(rhs, @tagName(field))); | |
| 10 | 10 | } |
| 11 | 11 | }.f); |
| 12 | 12 | } |