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 › Threaded › writeIntFd Private Function writeIntFd Doc Source Private Function std.Io.Threaded.writeIntFd
fn writeIntFd (fd : posix .fd_t , value : ErrInt ) !void Params File Io/Threaded.zig: 15693
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710 fn writeIntFd (fd : posix .fd_t , value : ErrInt ) !void {
var buffer : [8 ]u8 = undefined ;
std .mem .writeInt (u64 , &buffer , value , .little );
// Skip the cancel mechanism.
var i : usize = 0 ;
while (true ) {
const rc = posix .system .write (fd , buffer [i ..].ptr , buffer .len - i );
switch (posix .errno (rc )) {
.SUCCESS => {
const n : usize = @intCast (rc );
i += n ;
if (buffer .len - i == 0 ) return ;
},
.INTR => continue ,
else => return error .SystemResources ,
}
}
}