Skip to main content

Module collections

Module collections 

Source
Expand description

Hash maps and sets for the whole kernel.

FastMap and FastSet are hashbrown tables hashed by foldhash with a fixed seed. The seed is what matters: a map’s iteration order is then a function of its insertions alone, the same in every run and every process, so a stage that walks a map cannot answer differently from one run to the next. The std tables seed themselves randomly and are refused by clippy (disallowed-types in clippy.toml) outside the few public signatures that already promised them.

A fixed seed gives up the defence against keys chosen to collide. The kernel hashes its own ids and coordinates, not adversarial strings.

The tables have no new or with_capacity: build them with FastMap::default(), collect(), or FastMap::with_capacity_and_hasher(n, FastHasher::default()).

Modules§

hash_map
A hash map implemented with quadratic probing and SIMD lookup.
hash_set
A hash set implemented as a HashMap where the value is ().

Type Aliases§

FastHasher
The hasher every FastMap and FastSet builds: foldhash, seeded the same way in every process.
FastMap
A hash map whose iteration order depends only on its contents and the order they were inserted in.
FastSet
A hash set whose iteration order depends only on its contents and the order they were inserted in.