the.bay.news

How to properly use parseFromSlice()?

Ziggit
How to properly use parseFromSlice()?
Documentation says if arena is passed as an allocator, it’s better to use parseFromSliceLeaky(). I do pass arena, but I don’t have to in this function: pub fn readFile(io: std.Io, gpa: std.mem.Allocator, path: []const u8) !Reader { const file = try std.Io.Dir.cwd().openFile(io, path, .{ .mode = .read_only, .lock = .exclusive, }); defer file.close(io); const buf = try gpa.alloc(u8, try file.length(io)); var reader = file.reader(io, buf); // Read all conte...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.