chore: add type for options param into Timestamp.jsonStringify

This commit is contained in:
Simon Hartcher 2025-04-23 12:34:54 +10:00
parent 8007a910dd
commit e22b4246c1
3 changed files with 11 additions and 1 deletions

View file

@ -32,4 +32,10 @@ pub fn build(b: *std.Build) void {
.optimize = optimize, .optimize = optimize,
}); });
lib_mod.addImport("zeit", dep_zeit.module("zeit")); lib_mod.addImport("zeit", dep_zeit.module("zeit"));
const dep_json = b.dependency("json", .{
.target = target,
.optimize = optimize,
});
lib_mod.addImport("json", dep_json.module("json"));
} }

View file

@ -8,6 +8,9 @@
.url = "git+https://github.com/rockorager/zeit#fb6557ad4bd0cd0f0f728ae978061d7fe992c528", .url = "git+https://github.com/rockorager/zeit#fb6557ad4bd0cd0f0f728ae978061d7fe992c528",
.hash = "zeit-0.6.0-5I6bk29nAgDhK6AVMtXMWhkKTYgUncrWjnlI_8X9DPSd", .hash = "zeit-0.6.0-5I6bk29nAgDhK6AVMtXMWhkKTYgUncrWjnlI_8X9DPSd",
}, },
.json = .{
.path = "../json",
},
}, },
.paths = .{ .paths = .{
"build.zig", "build.zig",

View file

@ -1,5 +1,6 @@
const std = @import("std"); const std = @import("std");
const zeit = @import("zeit"); const zeit = @import("zeit");
const json = @import("json");
pub const DateFormat = enum { pub const DateFormat = enum {
rfc1123, rfc1123,
@ -9,7 +10,7 @@ pub const DateFormat = enum {
pub const Timestamp = enum(zeit.Nanoseconds) { pub const Timestamp = enum(zeit.Nanoseconds) {
_, _,
pub fn jsonStringify(value: Timestamp, options: anytype, out_stream: anytype) !void { pub fn jsonStringify(value: Timestamp, options: json.StringifyOptions, out_stream: anytype) !void {
_ = options; _ = options;
const instant = try zeit.instant(.{ const instant = try zeit.instant(.{