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 › zig › Ast › Render › drainNoNewline Private Function drainNoNewline Doc Source Private Function std.zig.Ast.Render.drainNoNewline
fn drainNoNewline (w : *Writer , data : []const []const u8 , splat : usize ) Writer .Error !usize Params w : *Writer data : []const []const u8 splat : usize File zig/Ast/Render.zig: 943
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964 fn drainNoNewline (w : *Writer , data : []const []const u8 , splat : usize ) Writer .Error !usize {
if (std .mem .findScalar (u8 , w .buffered (), '\n' ) != null ) {
return error .WriteFailed ;
}
var n : usize = 0 ;
for (data [0 .. data .len - 1 ]) |v | {
if (std .mem .findScalar (u8 , v , '\n' ) != null ) {
return error .WriteFailed ;
}
n += v .len ;
}
const pattern = data [data .len - 1 ];
if (splat != 0 and std .mem .findScalar (u8 , pattern , '\n' ) != null ) {
return error .WriteFailed ;
}
n += pattern .len * splat ;
w .end = 0 ;
return n ;
}