pub struct FixedMap<'a, const N: usize, const K: usize, const V: usize, H = FastHasher> { /* private fields */ }Expand description
A fixed-capacity hashmap over caller-provided storage.
N is the maximum number of entries, and K and V are the fixed key and
value sizes. The map uses 2 * N caller-provided slots, keeping occupancy
at or below 50%. The map itself does not allocate. Deletion is not supported.
Implementations§
Source§impl<'a, const N: usize, const K: usize, const V: usize, H: KeyHasher<K>> FixedMap<'a, N, K, V, H>
impl<'a, const N: usize, const K: usize, const V: usize, H: KeyHasher<K>> FixedMap<'a, N, K, V, H>
Sourcepub fn with_hasher(
entries: &'a mut [EntryStorage<K, V>],
tags: &'a mut [u8],
hasher: H,
) -> Result<Self, StorageError>
pub fn with_hasher( entries: &'a mut [EntryStorage<K, V>], tags: &'a mut [u8], hasher: H, ) -> Result<Self, StorageError>
Creates an empty map with a custom key hasher and supplied storage.
entries and tags must each contain at least 2 * N elements.
The required tags are cleared.
Sourcepub fn get(&self, key: &[u8; K]) -> Option<&[u8; V]>
pub fn get(&self, key: &[u8; K]) -> Option<&[u8; V]>
Gets a reference to the value for key, if present.
Source§impl<'a, const N: usize, const K: usize, const V: usize> FixedMap<'a, N, K, V, FastHasher>
impl<'a, const N: usize, const K: usize, const V: usize> FixedMap<'a, N, K, V, FastHasher>
Sourcepub fn new(
entries: &'a mut [EntryStorage<K, V>],
tags: &'a mut [u8],
) -> Result<Self, StorageError>
pub fn new( entries: &'a mut [EntryStorage<K, V>], tags: &'a mut [u8], ) -> Result<Self, StorageError>
Creates an empty map using the default fast, non-cryptographic hasher.
Auto Trait Implementations§
impl<'a, const N: usize, const K: usize, const V: usize, H = FastHasher> !UnwindSafe for FixedMap<'a, N, K, V, H>
impl<'a, const N: usize, const K: usize, const V: usize, H> Forget for FixedMap<'a, N, K, V, H>
impl<'a, const N: usize, const K: usize, const V: usize, H> Freeze for FixedMap<'a, N, K, V, H>
impl<'a, const N: usize, const K: usize, const V: usize, H> Move for FixedMap<'a, N, K, V, H>
impl<'a, const N: usize, const K: usize, const V: usize, H> RefUnwindSafe for FixedMap<'a, N, K, V, H>where
H: RefUnwindSafe,
impl<'a, const N: usize, const K: usize, const V: usize, H> Send for FixedMap<'a, N, K, V, H>where
H: Send,
impl<'a, const N: usize, const K: usize, const V: usize, H> Sync for FixedMap<'a, N, K, V, H>where
H: Sync,
impl<'a, const N: usize, const K: usize, const V: usize, H> Unpin for FixedMap<'a, N, K, V, H>
impl<'a, const N: usize, const K: usize, const V: usize, H> UnsafeUnpin for FixedMap<'a, N, K, V, H>where
&'a mut [MaybeUninit<([u8; K], [u8; V])>]: UnsafeUnpin,
&'a mut [u8]: UnsafeUnpin,
H: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more