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.
Zig › std/ › zig/ › llvm/ › Builder.zig › addTypeExtraAssumeCapacity
addTypeExtraAssumeCapacity
Builder.addTypeExtraAssumeCapacity
fn addTypeExtraAssumeCapacity (self : *Builder , extra : anytype ) Type .Item .ExtraIndex
File
Code
fn addTypeExtraAssumeCapacity (self : *Builder , extra : anytype ) Type .Item .ExtraIndex {
const result : Type .Item .ExtraIndex = @intCast (self .type_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 .type_extra .appendAssumeCapacity (switch (field_type ) {
u32 => value ,
String , Type => @backingInt (value ),
else => @compileError ("bad field type: " ++ field_name ++ ": " ++ @typeName (field_type )),
});
}
return result ;
}