Created
September 21, 2023 18:20
-
-
Save nothke/a20d8a286450687ff10a5a3c01546632 to your computer and use it in GitHub Desktop.
My zig snippets for VS Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Self": { | |
"prefix": "self", | |
"body": "const Self = @This();", | |
}, | |
"Scoped function": { | |
"prefix": "fnself", | |
"body": "fn ${1:MyScopedFunction}(self: Self) ${2:void} {$0}", | |
}, | |
"Mutable scoped function": { | |
"prefix": "fnselfmut", | |
"body": [ | |
"fn ${1:MyScopedFunction}(self: *Self) void {", | |
" self.*.$0;", | |
"}" | |
], | |
}, | |
"Function pointer": { | |
"prefix": "fnptr", | |
"body": "*const fn (${1:args}) ${2:ReturnType}", | |
}, | |
"General purpose allocator": { | |
"prefix" : "gpa", | |
"body": [ | |
"var gpa = std.heap.GeneralPurposeAllocator(.{}){};", | |
"defer _ = gpa.deinit();", | |
"const alloc = gpa.allocator();", | |
] | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment