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 library itself.
pubconstCompileError = externstruct {
msg: NullTerminatedString,
token: Ast.OptionalTokenIndex,
/// If `token == .none`, this is an `Ast.Node.Index`./// Otherwise, this is a byte offset into `token`.node_or_offset: u32,
/// Ignored if `note_count == 0`.first_note: u32,
note_count: u32,
pubfngetNotes(err: CompileError, zoir: Zoir) []constNote {
returnzoir.error_notes[err.first_note..][0..err.note_count];
}
pubconstNote = externstruct {
msg: NullTerminatedString,
token: Ast.OptionalTokenIndex,
/// If `token == .none`, this is an `Ast.Node.Index`./// Otherwise, this is a byte offset into `token`.node_or_offset: u32,
};
comptime {
assert(std.meta.hasUniqueRepresentation(CompileError));
assert(std.meta.hasUniqueRepresentation(Note));
}
}