authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-29 15:54:06 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-04-29 15:54:06 -07:00
logc3d2857693e3f03fdb68f27ccc89049f7552151a
tree44a18567c5403653d0d6d68f73b2ccbb9934b33b
parentbf867fae9d292da271537c7f9c7fcbc6848fb50a
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

fix compile error and make root option an enum


2 files changed, 15 insertions(+), 8 deletions(-)

src/main.zig+1-7
......@@ -4,13 +4,7 @@ const nfs = @import("nfs");
44
55pub const build_options = @import("build_options");
66
7pub const tracer_impl = switch (build_options.backend) {
8 0 => tracer.none,
9 1 => tracer.log,
10 2 => tracer.spall,
11 3 => tracer.chrome,
12 else => unreachable,
13};
7pub const tracer_backend: tracer.Backend = @enumFromInt(build_options.backend);
148
159pub fn main() !void {
1610 try tracer.init(.{});
src/mod.zig+14-1
......@@ -2,13 +2,26 @@ const std = @import("std");
22const root = @import("root");
33const extras = @import("extras");
44const nfs = @import("nfs");
5const impl = extras.globalOption("tracer_impl", type) orelse none;
5const backend: Backend = extras.globalOption("tracer_backend", Backend) orelse .none;
6const impl = switch (backend) {
7 .none => none,
8 .log => log,
9 .chrome => chrome,
10 .spall => spall,
11};
612
713pub const none = @import("./none.zig");
814pub const log = @import("./log.zig");
915pub const chrome = @import("./chrome.zig");
1016pub const spall = @import("./spall.zig");
1117
18pub const Backend = enum {
19 none,
20 log,
21 chrome,
22 spall,
23};
24
1225pub fn init(args: @typeInfo(@TypeOf(impl.init)).@"fn".params[0].type.?) !void {
1326 try impl.init(args);
1427}