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 library itself.
Zig › std/ › Io/ › Threaded.zig › addAfdBuf
addAfdBuf
Threaded.addAfdBuf
fn addAfdBuf (
comptime mutability : windows .AFD .Mutability ,
iovecs : []windows .AFD .WSABUF (mutability ),
len : *u32 ,
bytes : switch (mutability )
File
Code
fn addAfdBuf (
comptime mutability : windows .AFD .Mutability ,
iovecs : []windows .AFD .WSABUF (mutability ),
len : *u32 ,
bytes : switch (mutability ) {
.@"const" => []const u8 ,
.@"var" => []u8 ,
},
) void {
if (bytes .len == 0 ) return ;
const cap = std .math .maxInt (u32 );
var remaining = bytes ;
while (remaining .len > cap ) {
if (iovecs .len - len .* == 0 ) return ;
iovecs [len .*] = .{ .buf = remaining .ptr , .len = cap };
len .* += 1 ;
remaining = remaining [cap ..];
} else {
@branchHint (.likely );
if (iovecs .len - len .* == 0 ) return ;
iovecs [len .*] = .{ .buf = remaining .ptr , .len = @intCast (remaining .len ) };
len .* += 1 ;
}
}