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 › netSendPosix Private Type Function netSendPosix Doc Source Private Type Function std.Io.Threaded.netSendPosix
fn netSendPosix (
t : *Threaded ,
socket_handle : net .Socket .Handle ,
messages : []net .OutgoingMessage ,
flags : net .SendFlags ,
nonblocking : bool ,
) struct File Io/Threaded.zig: 12948
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976 fn netSendPosix (
t : *Threaded ,
socket_handle : net .Socket .Handle ,
messages : []net .OutgoingMessage ,
flags : net .SendFlags ,
nonblocking : bool ,
) struct { ?(net .Socket .SendError || error {WouldBlock }), usize } {
if (!have_networking ) return .{ error .NetworkDown , 0 };
const posix_flags : u32 =
@as (u32 , if (@hasDecl (posix .MSG , "CONFIRM" ) and flags .confirm ) posix .MSG .CONFIRM else 0 ) |
@as (u32 , if (@hasDecl (posix .MSG , "DONTROUTE" ) and flags .dont_route ) posix .MSG .DONTROUTE else 0 ) |
@as (u32 , if (@hasDecl (posix .MSG , "EOR" ) and flags .eor ) posix .MSG .EOR else 0 ) |
@as (u32 , if (@hasDecl (posix .MSG , "OOB" ) and flags .oob ) posix .MSG .OOB else 0 ) |
@as (u32 , if (@hasDecl (posix .MSG , "FASTOPEN" ) and flags .fastopen ) posix .MSG .FASTOPEN else 0 ) |
@as (u32 , if (@hasDecl (posix .MSG , "DONTWAIT" ) and nonblocking ) posix .MSG .DONTWAIT else 0 ) |
posix .MSG .NOSIGNAL ;
var i : usize = 0 ;
while (messages .len - i != 0 ) {
if (have_sendmmsg ) {
i += netSendManyPosix (socket_handle , messages [i ..], posix_flags ) catch |err | return .{ err , i };
continue ;
}
t .netSendOnePosix (socket_handle , &messages [i ], posix_flags ) catch |err | return .{ err , i };
i += 1 ;
}
return .{ null , i };
}