From d2834174ee6a0011ee42fe43be2886c539a146ce Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 14 Jul 2022 17:12:03 -0700 Subject: [PATCH] update to stdlib breakage --- ulid.zig | 6 +++--- zig.mod | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ulid.zig b/ulid.zig index 848c07020822bfd83869d0b98b07aebe697c0686..2b54d654fc149f2d9f76816123ad86853cc8a189 100644 --- a/ulid.zig +++ b/ulid.zig @@ -19,14 +19,14 @@ pub const Factory = struct { pub fn newULID(self: Factory) ULID { const now = std.time.milliTimestamp(); return ULID{ - .timestamp = std.math.cast(u48, now - self.epoch) catch @panic("time.milliTimestamp() is higher than 281474976710655"), + .timestamp = std.math.cast(u48, now - self.epoch) orelse @panic("time.milliTimestamp() is higher than 281474976710655"), .randomnes = self.rand.int(u80), }; } }; /// 01AN4Z07BY 79KA1307SR9X4MV3 -/// +/// /// |----------| |----------------| /// Timestamp Randomness /// 48bits 80bits @@ -41,7 +41,7 @@ pub const ULID = struct { pub fn parse(alloc: std.mem.Allocator, value: BaseType) !ULID { if (value.len != 26) return error.Ulid; return ULID{ - .timestamp = try std.math.cast(u48, try extras.sliceToInt(u50, u5, try base32.decode(alloc, value[0..10]))), + .timestamp = std.math.cast(u48, try extras.sliceToInt(u50, u5, try base32.decode(alloc, value[0..10]))) orelse return error.Ulid, .randomnes = try extras.sliceToInt(u80, u5, try base32.decode(alloc, value[10..26])), }; } diff --git a/zig.mod b/zig.mod index 8cd22300725e6d974aaea838b1b1903801e4db31..2809806afbbd7e33b58829efedcd6fe105ee1388 100644 --- a/zig.mod +++ b/zig.mod @@ -3,6 +3,7 @@ name: ulid main: ulid.zig license: MIT description: ULID implementation for Zig +min_zig_version: 0.10.0-dev.2431+0e6285c8f dependencies: - src: git https://github.com/nektro/zig-range - src: git https://github.com/nektro/zig-extras -- 2.54.0