Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Public Struct

FieldIterator

Public Struct
std.zig.Zir.UnwrappedUnionDecl.FieldIterator
pub const FieldIterator = struct

Fields

next_idx: u32
names: []const NullTerminatedString
type_body_lens: []const u32
align_body_lens: ?[]const u32
value_body_lens: ?[]const u32
bodies_overlong: []const Inst.Index

Structs

Functions

pub fn next(it: *FieldIterator) ?Field
fn body(it: *FieldIterator, len: u32) ?[]const Inst.Index

File

zig/Zir.zig:5522
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
    pub const FieldIterator = struct {
        next_idx: u32,
        names: []const NullTerminatedString,
        type_body_lens: []const u32,
        align_body_lens: ?[]const u32,
        value_body_lens: ?[]const u32,
        bodies_overlong: []const Inst.Index,
        pub const Field = struct {
            idx: u32,
            name: NullTerminatedString,
            type_body: ?[]const Inst.Index,
            align_body: ?[]const Inst.Index,
            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],
                .type_body = it.body(it.type_body_lens[idx]),
                .align_body = it.body(if (it.align_body_lens) |l| l[idx] else 0),
                .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;
        }
    }