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 › testing › SliceDiffer › write Public Function write Doc Source Public Function std.testing.SliceDiffer.write
pub fn write (self : Self , writer : *Io .Writer ) !void Params File testing.zig: 444
444
445
446
447
448
449
450
451
452
453
454
455
456
457 pub fn write (self : Self , writer : *Io .Writer ) !void {
const t : Io .Terminal = .{ .writer = writer , .mode = self .terminal_mode };
for (self .expected , 0 ..) |value , i | {
const full_index = self .start_index + i ;
const diff = if (i < self .actual .len ) !std .meta .eql (self .actual [i ], value ) else true ;
if (diff ) try t .setColor (.red );
if (@typeInfo (T ) == .pointer ) {
try writer .print ("[{}]{*}: {any}\n" , .{ full_index , value , value });
} else {
try writer .print ("[{}]: {any}\n" , .{ full_index , value });
}
if (diff ) try t .setColor (.reset );
}
}