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.

addExtraAssumeCapacity

Interner.addExtraAssumeCapacity
fn addExtraAssumeCapacity(i: *Interner, extra: anytype) u32

File

Code

fn addExtraAssumeCapacity(i: *Interner, extra: anytype) u32 {
    const result = @as(u32, @intCast(i.extra.items.len));
    const info = @typeInfo(@TypeOf(extra)).@"struct";
    inline for (info.field_names, info.field_types) |field_name, field_type| {
        i.extra.appendAssumeCapacity(switch (field_type) {
            Ref => @backingInt(@field(extra, field_name)),
            u32 => @field(extra, field_name),
            else => @compileError("bad field type: " ++ @typeName(field_type)),
        });
    }
    return result;
}