What "default IO" to use for a C API?

,

I’m writing a C API for a Zig library compatible with the latest 0.16 nightly build. Its init function takes an allocator and an IO. My goal is to make the library usable from other programming environments including the browser via WASM.

For the allocator, I’m doing something like this:

fn defaultAllocator() std.mem.Allocator {
    return switch (builtin.target.cpu.arch) {
        .wasm32, .wasm64 => std.heap.wasm_allocator,
        else => std.heap.c_allocator,
    };
}

But it’s not clear to me what I’m supposed to do for the IO. Are there equivalents to std.heap.wasm_allocator and std.heap.c_allocator but for IO? If not, what do I do?

P.S. Please let me know if what I’m doing for the allocator doesn’t make sense – I’m fairly new to Zig.

For now, there are only Io.Threaded an Io.Evented, and evented is not implemented for all OSs, so I think you’re stuck with threaded.