fixed_hashmap/lib.rs
1#![no_std]
2
3//! A fixed-capacity hashmap for fixed-size byte keys and values.
4//!
5//! The map uses caller-provided storage and does not allocate.
6//!
7//! ```
8//! use core::mem::MaybeUninit;
9//! use fixed_hashmap::{EntryStorage, FixedMap};
10//!
11//! let mut entries: [EntryStorage<2, 2>; 16] =
12//! core::array::from_fn(|_| MaybeUninit::uninit());
13//! let mut tags = [0; 16];
14//! let mut map = FixedMap::<8, 2, 2>::new(&mut entries, &mut tags).unwrap();
15//! map.insert(*b"hi", *b"ok").unwrap();
16//! assert_eq!(map.get(b"hi"), Some(b"ok"));
17//! ```
18
19#[cfg(test)]
20extern crate std;
21
22mod hash;
23mod map;
24mod simd;
25
26#[cfg(feature = "secure-hash")]
27pub use hash::SecureHasher;
28pub use hash::{FastHasher, KeyHasher};
29pub use map::{EntryStorage, FixedMap, InsertError, StorageError};