Expand description
Specialized hash containers.
Two keys in this crate already carry enough entropy to skip the default hasher:
Entityis a pair of integers packed into oneu64.EntityHashspreads that value upward with a Fibonacci multiply, which is where the SwissTable needs the bits, while leaving the low bits so that entities spawned together land together.TypeIdis itself a high-quality hash, soTypeIdHashMapusesNoOpHashandNoOpHasherforwards theu64theHashimpl writes.
EntityHasher panics on a key that is not u64-shaped, which is a
programming error in this crateβs own use of it. NoOpHasher does not:
it folds byte-wise writes rather than panicking, so a container that hashes
a non-u64 key still works, if with a worse hash.
Re-exportsΒ§
use core::any::TypeId;πuse core::hash::BuildHasher;πuse core::hash::Hash;πuse core::hash::Hash;πuse core::hash::Hasher;πuse hashbrown::HashMap;πuse hashbrown::HashSet;πuse crate::entity::Entity;π
StructsΒ§
- Entity
Hash - A
BuildHasherfor generational indices. - Entity
Hasher - The hasher of
EntityHash. - NoOp
Hash - A
BuildHasherthat passesu64keys through unchanged. - NoOp
Hasher - The hasher of
NoOpHash.
Type AliasesΒ§
- Entity
Hash Map - A hash map keyed by
Entity. - Entity
Hash Set - A hash set of
Entitys. - Type
IdHash Map - A hash map keyed by
TypeId. - Type
IdHash Set - A hash set of
TypeIds.