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/ › BitcodeReader.zig › Record
Record
BitcodeReader.Record
pub const Record = struct
File
Code
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 () };
}
}