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 library itself.
fnipcThreadRun(io: Io, file: Io.File) WorkerError!void {
// Store this data in the thread so that it does not need to be part of the
// linker data of the main executable.
varserialized_buffer: Serialized.Buffer = undefined;
serialized_buffer.init();
deferserialized_buffer.batch.cancel(io);
varfw = file.writerStreaming(io, &.{});
_ = tryio.sleep(.fromNanoseconds(global_progress.initial_delay_ns), .awake);
while (true) {
writeIpc(&fw.interface, tryserialize(io, &serialized_buffer)) catch |err| switch (err) {
error.WriteFailed => returnfw.err.?,
};
_ = tryio.sleep(.fromNanoseconds(global_progress.refresh_rate_ns), .awake);
}
}