DoxigAlpha

Function parameters

Parameters

#
it:*Iterator

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
StringHashMap
Builtin hashmap for strings as keys.
StringHashMapUnmanaged
Key memory is managed by the caller.
HashMap
General purpose hash table.
HashMapUnmanaged
A HashMap based on open addressing and linear probing.

= 80

Values

#

Source

Implementation

#
pub fn next(it: *Iterator) ?Entry {
    assert(it.index <= it.hm.capacity());
    if (it.hm.size == 0) return null;

    const cap = it.hm.capacity();
    const end = it.hm.metadata.? + cap;
    var metadata = it.hm.metadata.? + it.index;

    while (metadata != end) : ({
        metadata += 1;
        it.index += 1;
    }) {
        if (metadata[0].isUsed()) {
            const key = &it.hm.keys()[it.index];
            const value = &it.hm.values()[it.index];
            it.index += 1;
            return Entry{ .key_ptr = key, .value_ptr = value };
        }
    }

    return null;
}