Expand description
A fixed-capacity hashmap for fixed-size byte keys and values.
The map uses caller-provided storage and does not allocate.
use core::mem::MaybeUninit;
use fixed_hashmap::{EntryStorage, FixedMap};
let mut entries: [EntryStorage<2, 2>; 16] =
core::array::from_fn(|_| MaybeUninit::uninit());
let mut tags = [0; 16];
let mut map = FixedMap::<8, 2, 2>::new(&mut entries, &mut tags).unwrap();
map.insert(*b"hi", *b"ok").unwrap();
assert_eq!(map.get(b"hi"), Some(b"ok"));Structs§
- Fast
Hasher - Fast, non-cryptographic key hasher used by default.
- Fixed
Map - A fixed-capacity hashmap over caller-provided storage.
- Insert
Error - A key-value pair rejected because the map was full.
Enums§
- Storage
Error - Error returned when the backing storage is too small for a map.
Traits§
- KeyHasher
- Hash strategy used by a fixed map.
Type Aliases§
- Entry
Storage - Caller-provided, uninitialized storage for one key-value entry.