zigar.thread.WorkQueue(ns).Promisified(func) - chung-leong/zigar GitHub Wiki
Return a function type that has same arguments as the given function with the addition of either a Promise.
You generally don't need to use this function directly.
Usage
const std = @import("std");
const zigar = @import("zigar");
pub fn printTypeNames() void {
const T1 = zigar.thread.WorkQueue(ns).Promisified(ns.hello);
const T2 = zigar.thread.WorkQueue(ns).Promisified(.shutdown);
std.debug.print("{s}\n", .{@typeName(T1)});
std.debug.print("{s}\n", .{@typeName(T2)});
}
const ns = struct {
pub fn hello() void {
std.Thread.sleep(500 * 1000000); // pause for half a second
std.debug.print("Hello, world!", .{});
}
};
import { printTypeNames } from './work-queue-example-9.zig';
printTypeNames();
fn (type.promise.Promise(void)) error{OutOfMemory,Unexpected}!void
fn (type.promise.Promise(void)) void
Arguments:
func:anytype
A function or enum literal.
Return value:
type