Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Private Function

addMetadataExtraAssumeCapacity

Private Function
std.zig.llvm.Builder.addMetadataExtraAssumeCapacity
fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item.ExtraIndex

Params

File

zig/llvm/Builder.zig:13219
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item.ExtraIndex {
    const result: Metadata.Item.ExtraIndex = @intCast(self.metadata_extra.items.len);
    const info = @typeInfo(@TypeOf(extra)).@"struct";
    inline for (info.field_names, info.field_types) |field_name, field_type| {
        const value = @field(extra, field_name);
        self.metadata_extra.appendAssumeCapacity(switch (field_type) {
            u32 => value,
            Metadata.String, Metadata.String.Optional, Variable.Index, Value => @backingInt(value),
            Metadata, Metadata.Optional, Metadata.DIFlags => @bitCast(value),
            else => @compileError("bad field type: " ++ @typeName(field_type)),
        });
    }
    return result;
}