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.
pubconstCpuModel = union(enum) {
/// Always nativenative,
/// Always baselinebaseline,
/// If CPU Architecture is native, then the CPU model will be native. Otherwise,/// it will be baseline.determined_by_arch_os,
explicit: *constTarget.Cpu.Model,
pubfneql(a: CpuModel, b: CpuModel) bool {
constTag = @typeInfo(CpuModel).@"union".tag_type.?;
consta_tag: Tag = a;
constb_tag: Tag = b;
if (a_tag != b_tag) returnfalse;
returnswitch (a) {
.native, .baseline, .determined_by_arch_os => true,
.explicit => |a_model| a_model == b.explicit,
};
}
}