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 Function

next

Public Function
std.zig.Zir.UnwrappedSwitchBlock.Case.Iterator.next
pub fn next(it: *Iterator) ?Case

Params

File

zig/Zir.zig:5171
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
            pub fn next(it: *Iterator) ?Case {
                const idx = it.next_idx;
                if (idx == it.prong_infos.len) return null;
                it.next_idx += 1;
                const scalar_cases_len = it.prong_infos.len - it.multi_case_items_lens.len;
                return if (idx < scalar_cases_len) .{
                    .index = .{
                        .kind = .scalar,
                        .value = @intCast(idx),
                    },
                    .prong_info = it.prong_infos[idx],
                    .item_infos = it.itemInfos(1),
                    .range_infos = &.{},
                } else .{
                    .index = .{
                        .kind = .multi,
                        .value = @intCast(idx - scalar_cases_len),
                    },
                    .prong_info = it.prong_infos[idx],
                    .item_infos = it.itemInfos(it.multi_case_items_lens[idx - scalar_cases_len]),
                    .range_infos = if (it.multi_case_ranges_lens) |ranges_lens| b: {
                        break :b @ptrCast(it.itemInfos(2 * ranges_lens[idx - scalar_cases_len]));
                    } else &.{},
                };
            }