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 › BitcodeReader › Record Public Struct Record Doc Source Public Struct std.zig.llvm.BitcodeReader.Record
pub const Record = struct Fields name : []const u8 id : u32 operands : []const u64 blob : []const u8 Functions File zig/llvm/BitcodeReader.zig: 56
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 pub const Record = struct {
name : []const u8 ,
id : u32 ,
operands : []const u64 ,
blob : []const u8 ,
fn toOwnedAbbrev (record : Record , allocator : std .mem .Allocator ) !Abbrev {
var operands = std .array_list .Managed (Abbrev .Operand ).init (allocator );
defer operands .deinit ();
assert (record .id == Abbrev .Builtin .define_abbrev .toRecordId ());
var i : usize = 0 ;
while (i < record .operands .len ) switch (record .operands [i ]) {
Abbrev .Operand .literal_id => {
try operands .append (.{ .literal = record .operands [i + 1 ] });
i += 2 ;
},
@backingInt (Abbrev .Operand .Encoding .fixed ) => {
try operands .append (.{ .encoding = .{ .fixed = @intCast (record .operands [i + 1 ]) } });
i += 2 ;
},
@backingInt (Abbrev .Operand .Encoding .vbr ) => {
try operands .append (.{ .encoding = .{ .vbr = @intCast (record .operands [i + 1 ]) } });
i += 2 ;
},
@backingInt (Abbrev .Operand .Encoding .array ) => {
try operands .append (.{ .encoding = .{ .array = 6 } });
i += 1 ;
},
@backingInt (Abbrev .Operand .Encoding .char6 ) => {
try operands .append (.{ .encoding = .char6 });
i += 1 ;
},
@backingInt (Abbrev .Operand .Encoding .blob ) => {
try operands .append (.{ .encoding = .{ .blob = 6 } });
i += 1 ;
},
else => unreachable ,
};
return .{ .operands = try operands .toOwnedSlice () };
}
}