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 › ErrorBundle › Wip › setExtra Private Function setExtra Doc Source Private Function std.zig.ErrorBundle.Wip.setExtra
fn setExtra (wip : *Wip , index : usize , extra : anytype ) void Params wip : *Wip index : usize extra File zig/ErrorBundle.zig: 748
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762 fn setExtra (wip : *Wip , index : usize , extra : anytype ) void {
const extra_info = @typeInfo (@TypeOf (extra )).@"struct" ;
const field_names = extra_info .field_names ;
const field_types = extra_info .field_types ;
var i = index ;
inline for (field_names , field_types ) |field_name , field_type | {
wip .extra .items [i ] = switch (field_type ) {
u32 => @field (extra , field_name ),
MessageIndex => @backingInt (@field (extra , field_name )),
SourceLocationIndex => @backingInt (@field (extra , field_name )),
else => @compileError ("bad field type" ),
};
i += 1 ;
}
}