add init and deinit snippets for zig

This commit is contained in:
Squibid 2026-02-15 17:38:56 -05:00
parent efe9241d50
commit c48196d116
Signed by: squibid
GPG key ID: BECE5684D3C4005D

View file

@ -7,4 +7,18 @@ return {
f(file_name, {}),
t(" = @This();"),
}),
s("init", {
t("pub fn init() !*"),
f(file_name, {}),
t({ " {", "\tconst self = try gpa.create(" }),
f(file_name, {}),
t({ ");", "\tself.* = .{};", "\treturn self;", "}" }),
}),
s("deinit", {
t("pub fn deinit(self: *"),
f(file_name, {}),
t({ ") void {", "\tgpa.destroy(self);", "}" }),
}),
}