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 › Progress › appendTreeSymbol Private Function appendTreeSymbol Doc Source Private Function std.Progress.appendTreeSymbol
fn appendTreeSymbol (symbol : TreeSymbol , buf : []u8 , start_i : usize ) usize Params File Progress.zig: 890
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911 fn appendTreeSymbol (symbol : TreeSymbol , buf : []u8 , start_i : usize ) usize {
switch (global_progress .terminal_mode ) {
.off => unreachable ,
.ansi_escape_codes => {
const bytes = symbol .escapeSeq ();
buf [start_i ..][0 ..bytes .len ].* = bytes .*;
return start_i + bytes .len ;
},
.windows_api => |windows_api | {
const bytes = switch (windows_api .code_page ) {
// Code page 437 is the default code page and contains the box drawing symbols
437 => symbol .bytes (.code_page_437 ),
// UTF-8
65001 => symbol .bytes (.utf8 ),
// Fall back to ASCII approximation
else => symbol .bytes (.ascii ),
};
@memcpy (buf [start_i ..][0 ..bytes .len ], bytes );
return start_i + bytes .len ;
},
}
}