| ... | ... | @@ -54,9 +54,13 @@ pub const ULID = struct { |
| 54 | 54 | pub const fromString = readField; |
| 55 | 55 | pub const toString = bindField; |
| 56 | 56 | |
| 57 | | pub fn format(self: ULID, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) @TypeOf(writer).Error!void { |
| 57 | pub fn format(self: ULID, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| 58 | 58 | _ = fmt; |
| 59 | 59 | _ = options; |
| 60 | | try writer.writeAll(self.toString()); |
| 60 | |
| 61 | var buf: [26]u8 = undefined; |
| 62 | base32.formatInt(u48, self.timestamp, buf[0..10]); |
| 63 | base32.formatInt(u80, self.randomnes, buf[10..26]); |
| 64 | try writer.writeAll(&buf); |
| 61 | 65 | } |
| 62 | 66 | }; |