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 › Zir › UnwrappedEnumDecl Public Struct UnwrappedEnumDecl Doc Source Public Struct std.zig.Zir.UnwrappedEnumDecl
pub const UnwrappedEnumDecl = struct Fields Structs Functions File zig/Zir.zig: 5618
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672 pub const UnwrappedEnumDecl = struct {
src_line : u32 ,
src_column : u32 ,
src_node : Ast .Node .Index ,
name_strategy : Inst .NameStrategy ,
captures : []const Inst .Capture ,
capture_names : []const NullTerminatedString ,
decls : []const Inst .Index ,
tag_type_body : ?[]const Inst .Index ,
nonexhaustive : bool ,
field_names : []const NullTerminatedString ,
field_value_body_lens : ?[]const u32 ,
field_bodies_overlong : []const Inst .Index ,
pub fn iterateFields (enum_decl : UnwrappedEnumDecl ) FieldIterator {
return .{
.next_idx = 0 ,
.names = enum_decl .field_names ,
.value_body_lens = enum_decl .field_value_body_lens ,
.bodies_overlong = enum_decl .field_bodies_overlong ,
};
}
pub const FieldIterator = struct {
next_idx : u32 ,
names : []const NullTerminatedString ,
value_body_lens : ?[]const u32 ,
bodies_overlong : []const Inst .Index ,
pub const Field = struct {
idx : u32 ,
name : NullTerminatedString ,
value_body : ?[]const Inst .Index ,
};
pub fn next (it : *FieldIterator ) ?Field {
const idx = it .next_idx ;
if (idx == it .names .len ) return null ;
it .next_idx += 1 ;
return .{
.idx = idx ,
.name = it .names [idx ],
.value_body = it .body (if (it .value_body_lens ) |l | l [idx ] else 0 ),
};
}
fn body (it : *FieldIterator , len : u32 ) ?[]const Inst .Index {
if (len == 0 ) return null ;
const b = it .bodies_overlong [0 ..len ];
it .bodies_overlong = it .bodies_overlong [len ..];
return b ;
}
};
}