fixed-hashmap 0.1.0

A fixed-capacity, allocation-free hashmap for fixed-size byte keys and values
Documentation
use core::mem::MaybeUninit;
use fixed_hashmap::{EntryStorage, FixedMap, InsertError};

const CAPACITY: usize = 2;

fn main() {
    let mut entries: [EntryStorage<4, 1>; CAPACITY * 2] =
        core::array::from_fn(|_| MaybeUninit::uninit());
    let mut tags = [0; CAPACITY * 2];
    let mut map = FixedMap::<CAPACITY, 4, 1>::new(&mut entries, &mut tags)
        .expect("backing storage has twice the entry capacity");

    map.insert(*b"one1", [1]).expect("capacity is available");
    map.insert(*b"two2", [2]).expect("capacity is available");
    assert!(map.is_full());

    assert_eq!(map.insert(*b"one1", [9]), Ok(Some([1])));
    assert_eq!(
        map.insert(*b"thre", [3]),
        Err(InsertError {
            key: *b"thre",
            value: [3],
        })
    );
}