Zig 0.17.0-dev (Split by item) 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 standard library.
std › Io › Uring › writeSync Private Function writeSync Doc Source Private Function std.Io.Uring.writeSync
fn writeSync (sync : *CancelRegion .Sync , fd : fd_t , buffer : []const u8 ) File .Writer .Error !usize Params File Io/Uring.zig: 6083
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106 fn writeSync (sync : *CancelRegion .Sync , fd : fd_t , buffer : []const u8 ) File .Writer .Error !usize {
while (true ) {
try sync .cancel_region .await (.nothing );
const rc = linux .write (fd , buffer .ptr , buffer .len );
switch (linux .errno (rc )) {
.SUCCESS => return @intCast (rc ),
.INTR => {},
.INVAL => |err | return errnoBug (err ),
.FAULT => |err | return errnoBug (err ),
.AGAIN => return error .WouldBlock ,
.BADF => return error .NotOpenForWriting , // Can be a race condition.
.DESTADDRREQ => |err | return errnoBug (err ), // `connect` was never called.
.DQUOT => return error .DiskQuota ,
.FBIG => return error .FileTooBig ,
.IO => return error .InputOutput ,
.NOSPC => return error .NoSpaceLeft ,
.PERM => return error .PermissionDenied ,
.PIPE => return error .BrokenPipe ,
.CONNRESET => |err | return errnoBug (err ), // Not a socket handle.
.BUSY => return error .DeviceBusy ,
else => |err | return unexpectedErrno (err ),
}
}
}