structstd.array_hash_map.ArrayHashMapUnmanaged.Iterator[src]

Fields

keys: [*]K
values: [*]V
len: u32
index: u32 = 0

Functions

Functionnext[src]

pub fn next(it: *Iterator) ?Entry

Parameters

Source Code

Source code
pub fn next(it: *Iterator) ?Entry {
    if (it.index >= it.len) return null;
    const result = Entry{
        .key_ptr = &it.keys[it.index],
        // workaround for #6974
        .value_ptr = if (@sizeOf(*V) == 0) undefined else &it.values[it.index],
    };
    it.index += 1;
    return result;
}

Functionreset[src]

pub fn reset(it: *Iterator) void

Reset the iterator to the initial index

Parameters

Source Code

Source code
pub fn reset(it: *Iterator) void {
    it.index = 0;
}

Source Code

Source code
pub const Iterator = struct {
    keys: [*]K,
    values: [*]V,
    len: u32,
    index: u32 = 0,

    pub fn next(it: *Iterator) ?Entry {
        if (it.index >= it.len) return null;
        const result = Entry{
            .key_ptr = &it.keys[it.index],
            // workaround for #6974
            .value_ptr = if (@sizeOf(*V) == 0) undefined else &it.values[it.index],
        };
        it.index += 1;
        return result;
    }

    /// Reset the iterator to the initial index
    pub fn reset(it: *Iterator) void {
        it.index = 0;
    }
}