pub struct CHashMap<K, V, A: Allocator = DefaultHeap> { /* private fields */ }Expand description
A dynamically-sized open adressing quadratic probing hashmap
that can be stored in compact sequential storage and
automatically spills over into free heap storage using Allocator.
Implementations§
Source§impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> OpenAddressingMap<K, V, A>
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> OpenAddressingMap<K, V, A>
Sourcepub fn with_capacity(l: usize) -> Self
pub fn with_capacity(l: usize) -> Self
constructor
Sourcepub fn contains_key(&self, query: K) -> bool
pub fn contains_key(&self, query: K) -> bool
Does the dictionary contain a value for query?
Sourcepub fn insert(&mut self, query: K, value: V) -> Option<V>
pub fn insert(&mut self, query: K, value: V) -> Option<V>
Insert new value at key query and return the previous value at that key, if any existed
Sourcepub fn remove(&mut self, query: K) -> Option<V>
pub fn remove(&mut self, query: K) -> Option<V>
Remove value at key query and return it, if it existed
Sourcepub fn keys<'a>(&'a self) -> impl Iterator<Item = &'a K> + 'a
pub fn keys<'a>(&'a self) -> impl Iterator<Item = &'a K> + 'a
Iterator over all keys in the dictionary
Sourcepub fn values<'a>(&'a self) -> impl Iterator<Item = &'a V> + 'a
pub fn values<'a>(&'a self) -> impl Iterator<Item = &'a V> + 'a
Iterator over all values in the dictionary
Sourcepub fn values_mut<'a>(&'a mut self) -> impl Iterator<Item = &'a mut V> + 'a
pub fn values_mut<'a>(&'a mut self) -> impl Iterator<Item = &'a mut V> + 'a
Iterator over mutable references to all values in the dictionary
Source§impl<K: Hash + Eq + Copy, I: Compact, A1: Allocator, A2: Allocator> OpenAddressingMap<K, CompactVec<I, A1>, A2>
impl<K: Hash + Eq + Copy, I: Compact, A1: Allocator, A2: Allocator> OpenAddressingMap<K, CompactVec<I, A1>, A2>
Trait Implementations§
Source§impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> Compact for OpenAddressingMap<K, V, A>
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> Compact for OpenAddressingMap<K, V, A>
Source§default fn is_still_compact(&self) -> bool
default fn is_still_compact(&self) -> bool
Is the object’s dynamic part stored compactly?
Source§default fn dynamic_size_bytes(&self) -> usize
default fn dynamic_size_bytes(&self) -> usize
Size of the dynamic part in bytes
Source§default unsafe fn compact(
source: *mut Self,
dest: *mut Self,
new_dynamic_part: *mut u8,
)
default unsafe fn compact( source: *mut Self, dest: *mut Self, new_dynamic_part: *mut u8, )
Copy the static part of
source to dest and compactly store
the dynamic part of source as the new dynamic part of dest at new_dynamic_part.
This semantically moves source into dest.Source§unsafe fn decompact(source: *const Self) -> OpenAddressingMap<K, V, A>
unsafe fn decompact(source: *const Self) -> OpenAddressingMap<K, V, A>
Creates a clone of self with the dynamic part guaranteed to be stored freely. Read more
Source§fn total_size_bytes(&self) -> usize
fn total_size_bytes(&self) -> usize
Total size of the object (static part + dynamic part)
Source§unsafe fn behind(ptr: *mut Self) -> *mut u8
unsafe fn behind(ptr: *mut Self) -> *mut u8
Get a pointer to behind the static part of
self (commonly used place for the dynamic part)Source§unsafe fn compact_behind(source: *mut Self, dest: *mut Self)
unsafe fn compact_behind(source: *mut Self, dest: *mut Self)
Like
compact with new_dynamic_part set to dest.behind()Source§impl<K: Copy + Eq + Hash + Debug, V: Compact + Clone + Debug, A: Allocator> Debug for OpenAddressingMap<K, V, A>
impl<K: Copy + Eq + Hash + Debug, V: Compact + Clone + Debug, A: Allocator> Debug for OpenAddressingMap<K, V, A>
Auto Trait Implementations§
impl<K, V, A> Freeze for OpenAddressingMap<K, V, A>
impl<K, V, A> RefUnwindSafe for OpenAddressingMap<K, V, A>
impl<K, V, A = DefaultHeap> !Send for OpenAddressingMap<K, V, A>
impl<K, V, A = DefaultHeap> !Sync for OpenAddressingMap<K, V, A>
impl<K, V, A> Unpin for OpenAddressingMap<K, V, A>
impl<K, V, A> UnwindSafe for OpenAddressingMap<K, V, A>
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