Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

async

Public Function
std.Io.Group.async
pub fn async(g: *Group, io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void

Equivalent to Io.async, except the task is spawned in this Group instead of becoming associated with a Future.

The return type of function must be coercible to Cancelable!void. function returning error.Canceled does nothing because it is an cancelation propagation boundary.

Once this function is called, there are resources associated with the group. To release those resources, await or cancel must eventually be called.

function is not guaranteed to have been called until await or cancel is called.

Params

File

Io.zig:1357
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
    pub fn async(g: *Group, io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {
        const Args = @TypeOf(args);
        const TypeErased = struct {
            fn start(context: *const anyopaque) void {
                const args_casted: *const Args = @ptrCast(@alignCast(context));
                _ = @as(Cancelable!void, @call(.auto, function, args_casted.*)) catch {};
            }
        };
        io.vtable.groupAsync(io.userdata, g, @ptrCast(&args), .of(Args), TypeErased.start);
    }