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.
pubconstFixups = struct {
/// The key is the mut token (`var`/`const`) of the variable declaration/// that should have a `_ = foo;` inserted afterwards.unused_var_decls: std.AutoHashMapUnmanaged(Ast.TokenIndex, void) = .empty,
/// The functions in this unordered set of AST fn decl nodes will render/// with a function body of `@trap()` instead, with all parameters/// discarded.gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty,
/// These global declarations will be omitted.omit_nodes: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty,
/// These expressions will be replaced with the string value.replace_nodes_with_string: std.AutoHashMapUnmanaged(Ast.Node.Index, []constu8) = .empty,
/// The string value will be inserted directly after the node.append_string_after_node: std.AutoHashMapUnmanaged(Ast.Node.Index, []constu8) = .empty,
/// These nodes will be replaced with a different node.replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty,
/// Change all identifier names matching the key to be value instead.rename_identifiers: std.array_hash_map.String([]constu8) = .empty,
/// All `@import` builtin calls which refer to a file path will be prefixed/// with this path.rebase_imported_paths: ?[]constu8 = null,
pubfncount(f: Fixups) usize {
returnf.unused_var_decls.count() +
f.gut_functions.count() +
f.omit_nodes.count() +
f.replace_nodes_with_string.count() +
f.append_string_after_node.count() +
f.replace_nodes_with_node.count() +
f.rename_identifiers.count() +
@intFromBool(f.rebase_imported_paths != null);
}
pubfnclearRetainingCapacity(f: *Fixups) void {
f.unused_var_decls.clearRetainingCapacity();
f.gut_functions.clearRetainingCapacity();
f.omit_nodes.clearRetainingCapacity();
f.replace_nodes_with_string.clearRetainingCapacity();
f.append_string_after_node.clearRetainingCapacity();
f.replace_nodes_with_node.clearRetainingCapacity();
f.rename_identifiers.clearRetainingCapacity();
f.rebase_imported_paths = null;
}
pubfndeinit(f: *Fixups, gpa: Allocator) void {
f.unused_var_decls.deinit(gpa);
f.gut_functions.deinit(gpa);
f.omit_nodes.deinit(gpa);
f.replace_nodes_with_string.deinit(gpa);
f.append_string_after_node.deinit(gpa);
f.replace_nodes_with_node.deinit(gpa);
f.rename_identifiers.deinit(gpa);
f.* = undefined;
}
}