16 lines
378 B
Zig
16 lines
378 B
Zig
const std = @import("std");
|
|
|
|
pub fn ResultArena(comptime T: type) type {
|
|
return struct {
|
|
const Self = @This();
|
|
|
|
arena: *std.heap.ArenaAllocator,
|
|
value: T,
|
|
|
|
pub fn deinit(self: Self) void {
|
|
const allocator = self.arena.child_allocator;
|
|
self.arena.deinit();
|
|
allocator.destroy(self.arena);
|
|
}
|
|
};
|
|
}
|