zigar.function.PromiseOf(function) - chung-leong/zigar GitHub Wiki

Define a promise type with the return value type of function as the payload.

Example:

const std = @import("std");
const zigar = @import("zigar");

fn hello() anyerror!i32 {
    return 1234;
}

comptime {
    std.debug.assert(zigar.function.PromiseOf(hello) == zigar.function.Promise(anyerror!i32));
}

Arguments:

  • function: anytype
    A function or a function type.

Return value:

  • Promise(T)

Promise(T) | PromiseArgOf(function)