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 › ZonGen › addErrorInner Private Function addErrorInner Doc Source 850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873 fn addErrorInner (
zg : *ZonGen ,
token : Ast .OptionalTokenIndex ,
node_or_offset : u32 ,
comptime format : []const u8 ,
args : anytype ,
notes : []const Zoir .CompileError .Note ,
) Allocator .Error !void {
const gpa = zg .gpa ;
const first_note : u32 = @intCast (zg .error_notes .items .len );
try zg .error_notes .appendSlice (gpa , notes );
const message_idx : u32 = @intCast (zg .string_bytes .items .len );
try zg .string_bytes .print (gpa , format ++ "\x00" , args );
try zg .compile_errors .append (gpa , .{
.msg = @fromBackingInt (@intCast (message_idx )),
.token = token ,
.node_or_offset = node_or_offset ,
.first_note = first_note ,
.note_count = @intCast (notes .len ),
});
}