rokdocs
v0.1

rok::core::collections::dict

rok::core::collections::dict - Dict<K, V>, a hash map (stdlib spec 2.9.3), compact: entries are appended to dense key / value / hash arrays, and a power-of-two index of linear-probed slots maps a hash to its entry. A table of at most SMALL entries has no index: lookup scans the hashes. remove leaves a hole; holes are squeezed out when the entries are full. One object holds the counts and the current arrays, swapped on growth. Iteration follows the entries, so it is in insertion order (which OrderedDict relies on; for Dict the spec leaves it unspecified).

Structs

DictHead

pub struct DictHead<K

The dict's object. keys / vals have one more slot that stays zero: a hole's key and value are overwritten with it, so a removed entry keeps nothing alive. meta holds cap entry hashes (0: a hole), then slots index slots (0: empty, else entry + 1). An index slot of a removed entry stays, pointing at the hole: a tombstone, passed over because no lookup hash is 0. Index slots in use never exceed cap, at most 2/3 of slots, so probing always ends.

Dict

pub struct Dict<K

Entry

pub struct Entry<K

d.entry(k): read or fill one key's slot. Each call looks the key up again.

KeysIter

pub struct KeysIter<K

ValuesIter

pub struct ValuesIter<K

EntriesIter

pub struct EntriesIter<K

Functions

dict_literal

pub const fn dict_literal<K: Hash

{k: v, ..} (refs-lang 6.5.1, 6.5.6).