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 standard library.
std › zig › llvm › Builder › addMetadataExtraAssumeCapacity Private Function addMetadataExtraAssumeCapacity Doc Source 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 ;
}