authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-11-18 21:20:02 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-11-18 21:20:02 -08:00
log140bf8a8b9f2f66b277642f34c6573f91361957e
treed6725d9e2bc1c25ab11e6d1bf21849ec37512bf6
parent46452bdc5f40a6ee50ecf48d6ae893af0d8a5e5a

rename fromString -> parse


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

ulid.zig+4-4
......@@ -36,7 +36,7 @@ pub const ULID = struct {
3636
3737 pub const BaseType = string;
3838
39 pub fn readField(alloc: *std.mem.Allocator, value: BaseType) !ULID {
39 pub fn parse(alloc: *std.mem.Allocator, value: BaseType) !ULID {
4040 if (value.len != 26) return error.Ulid;
4141 return ULID{
4242 .timestamp = try std.math.cast(u48, try extras.sliceToInt(u50, u5, try base32.decode(alloc, value[0..10]))),
......@@ -44,15 +44,15 @@ pub const ULID = struct {
4444 };
4545 }
4646
47 pub fn bindField(self: ULID, alloc: *std.mem.Allocator) !BaseType {
47 pub fn toString(self: ULID, alloc: *std.mem.Allocator) !BaseType {
4848 var res = try std.ArrayList(u8).initCapacity(alloc, 26);
4949 defer res.deinit();
5050 try res.writer().print("{}", .{self});
5151 return res.toOwnedSlice();
5252 }
5353
54 pub const fromString = readField;
55 pub const toString = bindField;
54 pub const readField = parse;
55 pub const bindField = toString;
5656
5757 pub fn format(self: ULID, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
5858 _ = fmt;