Skip to main content

Module hash

Module hash 

Source
Expand description

no_std hash-map aliases with an atomic-free hasher.

std::collections::HashMap is unavailable on bare-metal targets (thumbv4t / GBA), so the engine uses hashbrown instead. hashbrown’s default hasher (foldhash) relies on core::sync::atomic::AtomicUsize, which the armv4t target does not provide, so this module supplies a fixed-seed FxHasher instead. FxHash is not cryptographically secure — irrelevant here: the maps key on trusted engine identifiers (tile ids, palette ids, event-flag names), not user input.

The aliases are API-compatible with std::collections::{HashMap, HashSet} for the engine’s usage (new, entry, get, insert, remove, iter, keys, values, retain, drain, …). Determinism note: unlike std’s RandomState, the seed is fixed, so iteration order is stable across runs — a property the save/serialization paths benefit from.

Structs§

FxBuildHasher
Const-constructible builder for FxHasher.
FxHasher
FxHash — the rustc hash. Small, fast, allocation- and atomic-free.

Type Aliases§

HashMap
Drop-in replacement for std::collections::HashMap.
HashSet
Drop-in replacement for std::collections::HashSet.