| ... | @@ -36,7 +36,7 @@ pub const ULID = struct { | ... | @@ -36,7 +36,7 @@ pub const ULID = struct { |
| 36 | | 36 | |
| 37 | pub const BaseType = string; | 37 | pub const BaseType = string; |
| 38 | | 38 | |
| 39 | pub fn parse(alloc: *std.mem.Allocator, value: BaseType) !ULID { | 39 | pub fn parse(alloc: std.mem.Allocator, value: BaseType) !ULID { |
| 40 | if (value.len != 26) return error.Ulid; | 40 | if (value.len != 26) return error.Ulid; |
| 41 | return ULID{ | 41 | return ULID{ |
| 42 | .timestamp = try std.math.cast(u48, try extras.sliceToInt(u50, u5, try base32.decode(alloc, value[0..10]))), | 42 | .timestamp = try std.math.cast(u48, try extras.sliceToInt(u50, u5, try base32.decode(alloc, value[0..10]))), |
| ... | @@ -44,7 +44,7 @@ pub const ULID = struct { | ... | @@ -44,7 +44,7 @@ pub const ULID = struct { |
| 44 | }; | 44 | }; |
| 45 | } | 45 | } |
| 46 | | 46 | |
| 47 | pub fn toString(self: ULID, alloc: *std.mem.Allocator) !BaseType { | 47 | pub fn toString(self: ULID, alloc: std.mem.Allocator) !BaseType { |
| 48 | var res = try std.ArrayList(u8).initCapacity(alloc, 26); | 48 | var res = try std.ArrayList(u8).initCapacity(alloc, 26); |
| 49 | defer res.deinit(); | 49 | defer res.deinit(); |
| 50 | try res.writer().print("{}", .{self}); | 50 | try res.writer().print("{}", .{self}); |