@Frame
@Frame
@Frame(func: anytype) type
This function returns the frame type of a function. This works for Async Functions as well as any function without a specific calling convention.
This type is suitable to be used as the return type of async which allows one to, for example, heap-allocate an async function frame:
test.zig
const std = @import("std");
test "heap allocated frame" {
const frame = try std.heap.page_allocator.create(@Frame(func));
frame.* = async func();
}
fn func() void {
suspend;
}
``` ```
$ zig test test.zig
1/1 test "heap allocated frame"... OK
All 1 tests passed.
