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.
pubconstio_uring_cqe = externstruct {
/// io_uring_sqe.data submission passed backuser_data: u64,
/// result code for this eventres: i32,
flags: u32,
// Followed by 16 bytes of padding if initialized with IORING_SETUP_CQE32, doubling cqe sizepubfnerr(self: io_uring_cqe) E {
if (self.res > -4096andself.res < 0) {
return@as(E, @fromBackingInt(@intCast(-self.res)));
}
return .SUCCESS;
}
// On successful completion of the provided buffers IO request, the CQE flags field
// will have IORING_CQE_F_BUFFER set and the selected buffer ID will be indicated by
// the upper 16-bits of the flags field.
pubfnbuffer_id(self: io_uring_cqe) !u16 {
if (self.flags & IORING_CQE_F_BUFFER != IORING_CQE_F_BUFFER) {
returnerror.NoBufferSelected;
}
return@as(u16, @intCast(self.flags >> IORING_CQE_BUFFER_SHIFT));
}
}