Struct compact::CHashMap [−][src]
pub struct CHashMap<K, V, A: Allocator = DefaultHeap> { /* fields omitted */ }
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
.
Methods
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> OpenAddressingMap<K, V, A>
[src]
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> OpenAddressingMap<K, V, A>
pub fn new() -> Self
[src]
pub fn new() -> Self
constructor
pub fn with_capacity(l: usize) -> Self
[src]
pub fn with_capacity(l: usize) -> Self
constructor
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Amount of entries in the dictionary
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Is the dictionary empty?
pub fn get(&self, query: K) -> Option<&V>
[src]
pub fn get(&self, query: K) -> Option<&V>
Look up the value for key query
, if it exists
pub fn get_mut(&mut self, query: K) -> Option<&mut V>
[src]
pub fn get_mut(&mut self, query: K) -> Option<&mut V>
get mutable
pub fn contains_key(&self, query: K) -> bool
[src]
pub fn contains_key(&self, query: K) -> bool
Does the dictionary contain a value for query
?
pub fn insert(&mut self, query: K, value: V) -> Option<V>
[src]
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
pub fn remove(&mut self, query: K) -> Option<V>
[src]
pub fn remove(&mut self, query: K) -> Option<V>
Remove value at key query
and return it, if it existed
pub fn keys<'a>(
&'a self
) -> impl Iterator<Item = &'a K> + 'a
[src]
pub fn keys<'a>(
&'a self
) -> impl Iterator<Item = &'a K> + 'a
Iterator over all keys in the dictionary
pub fn values<'a>(
&'a self
) -> impl Iterator<Item = &'a V> + 'a
[src]
pub fn values<'a>(
&'a self
) -> impl Iterator<Item = &'a V> + 'a
Iterator over all values in the dictionary
pub fn values_mut<'a>(
&'a mut self
) -> impl Iterator<Item = &'a mut V> + 'a
[src]
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
pub fn pairs<'a>(
&'a self
) -> impl Iterator<Item = (&'a K, &'a V)> + 'a
[src]
pub fn pairs<'a>(
&'a self
) -> impl Iterator<Item = (&'a K, &'a V)> + 'a
Iterator over all key-value pairs in the dictionary
pub fn pairs_mut<'a>(
&'a mut self
) -> impl Iterator<Item = (K, &'a mut V)> + 'a where
K: Copy,
[src]
pub fn pairs_mut<'a>(
&'a mut self
) -> impl Iterator<Item = (K, &'a mut V)> + 'a where
K: Copy,
Iterator over all key-value pairs in the dictionary, with the value as a mutable reference
impl<K: Hash + Eq + Copy, I: Compact, A1: Allocator, A2: Allocator> OpenAddressingMap<K, CompactVec<I, A1>, A2>
[src]
impl<K: Hash + Eq + Copy, I: Compact, A1: Allocator, A2: Allocator> OpenAddressingMap<K, CompactVec<I, A1>, A2>
pub fn push_at(&mut self, query: K, item: I)
[src]
pub fn push_at(&mut self, query: K, item: I)
Push a value onto the CompactVec
at the key query
pub fn get_iter<'a>(
&'a self,
query: K
) -> impl Iterator<Item = &'a I> + 'a
[src]
pub fn get_iter<'a>(
&'a self,
query: K
) -> impl Iterator<Item = &'a I> + 'a
Iterator over the CompactVec
at the key query
pub fn remove_iter<'a>(
&'a mut self,
query: K
) -> impl Iterator<Item = I> + 'a
[src]
pub fn remove_iter<'a>(
&'a mut self,
query: K
) -> impl Iterator<Item = I> + 'a
Remove the CompactVec
at the key query
and iterate over its elements (if it existed)
Trait Implementations
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> Compact for OpenAddressingMap<K, V, A>
[src]
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> Compact for OpenAddressingMap<K, V, A>
fn is_still_compact(&self) -> bool
[src]
fn is_still_compact(&self) -> bool
Is the object's dynamic part stored compactly?
fn dynamic_size_bytes(&self) -> usize
[src]
fn dynamic_size_bytes(&self) -> usize
Size of the dynamic part in bytes
unsafe fn compact(source: *mut Self, dest: *mut Self, new_dynamic_part: *mut u8)
[src]
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. Read more
unsafe fn decompact(source: *const Self) -> OpenAddressingMap<K, V, A>
[src]
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
fn total_size_bytes(&self) -> usize
[src]
fn total_size_bytes(&self) -> usize
Total size of the object (static part + dynamic part)
unsafe fn behind(ptr: *mut Self) -> *mut u8
[src]
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)
unsafe fn compact_behind(source: *mut Self, dest: *mut Self)
[src]
unsafe fn compact_behind(source: *mut Self, dest: *mut Self)
Like compact
with new_dynamic_part
set to dest.behind()
impl<K: Copy, V: Clone, A: Allocator> Clone for OpenAddressingMap<K, V, A>
[src]
impl<K: Copy, V: Clone, A: Allocator> Clone for OpenAddressingMap<K, V, A>
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> Default for OpenAddressingMap<K, V, A>
[src]
impl<K: Copy + Eq + Hash, V: Compact, A: Allocator> Default for OpenAddressingMap<K, V, A>
impl<K: Copy + Eq + Hash, V: Compact + Clone, A: Allocator> FromIterator<(K, V)> for OpenAddressingMap<K, V, A>
[src]
impl<K: Copy + Eq + Hash, V: Compact + Clone, A: Allocator> FromIterator<(K, V)> for OpenAddressingMap<K, V, A>
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter_to_be: T) -> Self
[src]
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter_to_be: T) -> Self
Construct a compact dictionary from an interator over key-value pairs
impl<K: Copy + Eq + Hash + Debug, V: Compact + Clone + Debug, A: Allocator> Debug for OpenAddressingMap<K, V, A>
[src]
impl<K: Copy + Eq + Hash + Debug, V: Compact + Clone + Debug, A: Allocator> Debug for OpenAddressingMap<K, V, A>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<K, V, A> Serialize for OpenAddressingMap<K, V, A> where
K: Copy + Eq + Hash + Serialize,
V: Compact + Serialize,
A: Allocator,
[src]
impl<K, V, A> Serialize for OpenAddressingMap<K, V, A> where
K: Copy + Eq + Hash + Serialize,
V: Compact + Serialize,
A: Allocator,
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de, K, V, A> Deserialize<'de> for OpenAddressingMap<K, V, A> where
K: Copy + Eq + Hash + Deserialize<'de>,
V: Compact + Deserialize<'de>,
A: Allocator,
[src]
impl<'de, K, V, A> Deserialize<'de> for OpenAddressingMap<K, V, A> where
K: Copy + Eq + Hash + Deserialize<'de>,
V: Compact + Deserialize<'de>,
A: Allocator,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more