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 › FieldIterator Public Struct FieldIterator Doc Source Public Struct std.zig.Zir.UnwrappedEnumDecl.FieldIterator
pub const FieldIterator = struct Fields Structs Functions File zig/Zir.zig: 5645
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 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 ;
}
}