Skip to main content

Module hmap

Module hmap 

Source
Expand description

This module contains the implementation of a closed hashmap from scratch. Because the interior of the implementation is exposed, one can use it to implement a biject hashmap without resorting to Copy, Clone, Rc or anything unsafe.

Structs§

Hmap
Structure of a HashMap, built from scratch, but which uses Rust’s built-in implmenetations of the Hash trait. This is a closed hash table with a linear probing rehash function. The table is a vector of Option. The vector maxhashes tracks the maximum number of hashes and rehashes required for a given hash slot. keylocs tracks locations of possible keys in the vector, which is important for quick iteration over the structure. The size/capacity of the vector is always set to a power of 2: this means instead of % capacity we can calculate & mask, where mask is always capacity-1; The hashstate is necessary for writing the hash function.
HmapIter
Structure for implementing Iterator trait