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.

WipDecls

AstGen.WipDecls
const WipDecls = struct

File

lib/std/zig/AstGen.zig:3943

Code

const WipDecls = struct {
    astgen: *AstGen,
    slice: Scratch.Slice,
    index: u32,

    fn init(scratch: *Scratch, decls_len: u32) Allocator.Error!WipDecls {
        return .{
            .astgen = scratch.astgen,
            .slice = try scratch.addSlice(decls_len),
            .index = 0,
        };
    }
    fn finish(wip: *WipDecls) void {
        assert(wip.index == wip.slice.len);
        wip.* = undefined;
    }
    fn nextDecl(wip: *WipDecls, decl_inst: Zir.Inst.Index) void {
        wip.slice.get(wip.astgen)[wip.index] = @backingInt(decl_inst);
        wip.index += 1;
    }
}