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 › Attribute › toStorage Private Function toStorage Doc Source Private Function std.zig.llvm.Builder.Attribute.toStorage
fn toStorage (self : Attribute ) Storage Params File zig/llvm/Builder.zig: 2505
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524 fn toStorage (self : Attribute ) Storage {
return switch (self ) {
inline else => |value , tag | .{ .kind = @as (Kind , self ), .value = switch (@TypeOf (value )) {
void => 0 ,
u32 => value ,
Alignment .Lazy , String , Type , UwTable => @backingInt (value ),
AllocKind , AllocSize , Captures , FpClass , Memory , VScaleRange => @bitCast (value ),
else => @compileError ("bad payload type: " ++ @tagName (tag ) ++ ": " ++ @typeName (@TypeOf (value ))),
} },
.initializes ,
.dead_on_return ,
.range ,
=> @panic ("TODO" ),
.string => |string_attr | .{
.kind = Kind .fromString (string_attr .kind ),
.value = @backingInt (string_attr .value ),
},
.none => unreachable ,
};
}