pub struct ConstMap<K, V, const N: usize>{
pub buckets: [Bucket<K, V>; N],
pub _phantom: PhantomData<fn() -> (K, V)>,
/* private fields */
}Expand description
Data structure that represents a hash map with a fixed size determined at compile time.
Use the macro const_map! to create a ConstMap in a very friendly manner.
Fields§
§buckets: [Bucket<K, V>; N]§_phantom: PhantomData<fn() -> (K, V)>Implementations§
Source§impl<K, V, const N: usize> ConstMap<K, V, N>
impl<K, V, const N: usize> ConstMap<K, V, N>
Sourcepub const fn new(buckets: [Bucket<K, V>; N]) -> Self
pub const fn new(buckets: [Bucket<K, V>; N]) -> Self
Creates a map from the already constructed buckets table.
Safety: The proc-macro must ensure that there are no duplicate keys or irresolvable collisions.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn items(&self) -> impl Iterator<Item = (&K, &V)>
pub fn keys(&self) -> impl Iterator<Item = &K>
pub fn values(&self) -> impl Iterator<Item = &V>
Trait Implementations§
impl<K, V: Copy, const N: usize> Copy for ConstMap<K, V, N>
Auto Trait Implementations§
impl<K, V, const N: usize> Freeze for ConstMap<K, V, N>
impl<K, V, const N: usize> RefUnwindSafe for ConstMap<K, V, N>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, const N: usize> Send for ConstMap<K, V, N>
impl<K, V, const N: usize> Sync for ConstMap<K, V, N>
impl<K, V, const N: usize> Unpin for ConstMap<K, V, N>
impl<K, V, const N: usize> UnwindSafe for ConstMap<K, V, N>where
K: UnwindSafe,
V: UnwindSafe,
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