Skip to content

zigar.function.PromiseArgOf(function)

Chung Leong edited this page Mar 19, 2025 · 2 revisions

Return the first promise type in the argument list of function.

Example:

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

fn world(promise: zigar.function.Promise(bool)) void {
    promise.resolve(true);
}

comptime {
    std.debug.assert(zigar.function.PromiseArgOf(world) == zigar.function.Promise(bool));
}

Arguments:

  • function: anytype
    A function or a function type.

Return value:

  • Promise(T)

Promise(T) | PromiseArgOf(function)

Clone this wiki locally