From 3b73a8edaff14039d917b1958715d1d54659851b Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Wed, 7 Jan 2026 21:01:09 +0100 Subject: chore: Update examples in README to use new std.Io --- example/simple-ex.zig | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'example/simple-ex.zig') diff --git a/example/simple-ex.zig b/example/simple-ex.zig index 7ab8d1e..f6a1c7f 100644 --- a/example/simple-ex.zig +++ b/example/simple-ex.zig @@ -1,6 +1,10 @@ pub fn main() !void { - var gpa = std.heap.DebugAllocator(.{}){}; - defer _ = gpa.deinit(); + var gpa_state = std.heap.DebugAllocator(.{}){}; + const gpa = gpa_state.allocator(); + defer _ = gpa_state.deinit(); + + var threaded: std.Io.Threaded = .init_single_threaded; + const io: std.Io = threaded.io(); // First we specify what parameters our program can take. // We can use `parseParamsComptime` to parse a string into an array of `Param(Help)`. @@ -23,9 +27,6 @@ pub fn main() !void { .ANSWER = clap.parsers.enumeration(YesNo), }; - var threaded: std.Io.Threaded = .init_single_threaded; - const io: std.Io = threaded.io(); - var diag = clap.Diagnostic{}; var res = clap.parse(clap.Help, ¶ms, parsers, .{ .diagnostic = &diag, -- cgit v1.2.3