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 › metadataExtraDataTrail Private Type Function metadataExtraDataTrail Doc Source Private Type Function std.zig.llvm.Builder.metadataExtraDataTrail
fn metadataExtraDataTrail (
self : *const Builder ,
comptime T : type ,
index : Metadata .Item .ExtraIndex ,
) struct File zig/llvm/Builder.zig: 13255
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277 fn metadataExtraDataTrail (
self : *const Builder ,
comptime T : type ,
index : Metadata .Item .ExtraIndex ,
) struct { data : T , trail : MetadataExtraDataTrail } {
var result : T = undefined ;
const info = @typeInfo (T ).@"struct" ;
inline for (
info .field_names ,
info .field_types ,
self .metadata_extra .items [index ..][0 ..info .field_names .len ],
) |field_name , field_type , value |
@field (result , field_name ) = switch (field_type ) {
u32 => value ,
Metadata .String , Metadata .String .Optional , Variable .Index , Value => @fromBackingInt (value ),
Metadata , Metadata .Optional , Metadata .DIFlags => @bitCast (value ),
else => @compileError ("bad field type: " ++ @typeName (field_type )),
};
return .{
.data = result ,
.trail = .{ .index = index + @as (Metadata .Item .ExtraIndex , @intCast (info .field_names .len )) },
};
}