add init and deinit snippets for zig
This commit is contained in:
parent
efe9241d50
commit
c48196d116
1 changed files with 14 additions and 0 deletions
|
|
@ -7,4 +7,18 @@ return {
|
||||||
f(file_name, {}),
|
f(file_name, {}),
|
||||||
t(" = @This();"),
|
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);", "}" }),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue