24 lines
468 B
Lua
24 lines
468 B
Lua
dofile(core.snippets)
|
|
|
|
return {
|
|
-- function snippet
|
|
s("this", {
|
|
t("const "),
|
|
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);", "}" }),
|
|
}),
|
|
}
|