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 library itself.

DeclContents

DeclContents contains all "interesting" instructions found within a declaration by findTrackable. These instructions are partitioned into a few different sets, since this makes ZIR instruction mapping more effective.

Zir.DeclContents
pub const DeclContents = struct

File

lib/std/zig/Zir.zig:4027

Code

pub const DeclContents = struct {
    /// This is a simple optional because ZIR guarantees that a `func`/`func_inferred`/`func_fancy` instruction
    /// can only occur once per `declaration`.
    func_decl: ?Inst.Index,
    type_decls: std.ArrayList(Inst.Index),
    other: std.ArrayList(Inst.Index),

    pub const init: DeclContents = .{
        .func_decl = null,
        .type_decls = .empty,
        .other = .empty,
    };

    pub fn clear(contents: *DeclContents) void {
        contents.func_decl = null;
        contents.type_decls.clearRetainingCapacity();
        contents.other.clearRetainingCapacity();
    }

    pub fn deinit(contents: *DeclContents, gpa: Allocator) void {
        contents.type_decls.deinit(gpa);
        contents.other.deinit(gpa);
    }
}