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 Type Function

metadataExtraDataTrail

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)) },
    };
}