structstd.enums.EnumArray.Iterator[src]

Fields

index: usize = 0
values: *[Indexer.count]Value

Functions

Functionnext[src]

pub fn next(self: *Iterator) ?Entry

Parameters

self: *Iterator

Source Code

Source code
pub fn next(self: *Iterator) ?Entry {
    const index = self.index;
    if (index < Indexer.count) {
        self.index += 1;
        return Entry{
            .key = Indexer.keyForIndex(index),
            .value = &self.values[index],
        };
    }
    return null;
}

Source Code

Source code
pub const Iterator = struct {
    index: usize = 0,
    values: *[Indexer.count]Value,

    pub fn next(self: *Iterator) ?Entry {
        const index = self.index;
        if (index < Indexer.count) {
            self.index += 1;
            return Entry{
                .key = Indexer.keyForIndex(index),
                .value = &self.values[index],
            };
        }
        return null;
    }
}