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 › Dispatch › addBuf Private Function addBuf Doc Source Private Function std.Io.Dispatch.addBuf
fn addBuf (
comptime is_const : bool ,
vec : []if (is_const ) iovec_const else iovec ,
vec_len : *iovlen_t ,
remaining : *Io .Limit ,
bytes : if (is_const ) []const u8 else []u8 ,
) void Params is_const : bool vec : []if (is_const ) iovec_const else iovec vec_len : *iovlen_t remaining : *Io .Limit bytes : if (is_const ) []const u8 else []u8 File Io/Dispatch.zig: 4968
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981 fn addBuf (
comptime is_const : bool ,
vec : []if (is_const ) iovec_const else iovec ,
vec_len : *iovlen_t ,
remaining : *Io .Limit ,
bytes : if (is_const ) []const u8 else []u8 ,
) void {
if (vec .len - vec_len .* == 0 ) return ;
const len = remaining .minInt (bytes .len );
if (len == 0 ) return ;
vec [vec_len .*] = .{ .base = bytes .ptr , .len = len };
vec_len .* += 1 ;
remaining .* = remaining .subtract (len ).?;
}