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 › netReadWindows Private Function netReadWindows Doc Source Private Function std.Io.Threaded.netReadWindows
fn netReadWindows (socket_handle : net .Socket .Handle , data : [][]u8 ) net .Stream .Reader .Error !usize Params socket_handle : net .Socket .Handle data : [][]u8 File Io/Threaded.zig: 12920
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946 fn netReadWindows (socket_handle : net .Socket .Handle , data : [][]u8 ) net .Stream .Reader .Error !usize {
var iovecs : [max_iovecs_len ]windows .AFD .WSABUF (.@"var" ) = undefined ;
var len : u32 = 0 ;
for (data ) |buf | {
if (iovecs .len - len == 0 ) break ;
addAfdBuf (.@"var" , &iovecs , &len , buf );
}
const iosb = try deviceIoControl (&.{
.file = .{ .handle = socket_handle , .flags = .{ .nonblocking = true } },
.code = windows .IOCTL .AFD .RECEIVE ,
.in = @ptrCast (&windows .AFD .RECV_INFO {
.BufferArray = &iovecs ,
.BufferCount = len ,
.AfdFlags = .{ .NO_FAST_IO = true , .OVERLAPPED = true },
.TdiFlags = .{ .NORMAL = true },
}),
});
switch (iosb .u .Status ) {
.SUCCESS => return iosb .Information ,
.CANCELLED => unreachable ,
.INSUFFICIENT_RESOURCES => return error .SystemResources ,
.CONNECTION_RESET , .REMOTE_DISCONNECT => return error .ConnectionResetByPeer ,
.IO_TIMEOUT => return error .ConnectionTimedOut ,
else => |status | return windows .unexpectedStatus (status ),
}
}