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 › addConstantExtraAssumeCapacity Private Function addConstantExtraAssumeCapacity Doc Source Private Function std.zig.llvm.Builder.addConstantExtraAssumeCapacity
fn addConstantExtraAssumeCapacity (self : *Builder , extra : anytype ) Constant .Item .ExtraIndex Params File zig/llvm/Builder.zig: 13141
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154 fn addConstantExtraAssumeCapacity (self : *Builder , extra : anytype ) Constant .Item .ExtraIndex {
const result : Constant .Item .ExtraIndex = @intCast (self .constant_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 .constant_extra .appendAssumeCapacity (switch (field_type ) {
u32 => value ,
String , Type , Constant , Function .Index , Function .Block .Index => @backingInt (value ),
Constant .GetElementPtr .Info => @bitCast (value ),
else => @compileError ("bad field type: " ++ @typeName (field_type )),
});
}
return result ;
}