[−][src]Struct ccl::dhashmap::DHashMap
DHashMap is a threadsafe concurrent hashmap with good allround performance and is tuned for both reads and writes.
The API mostly matches that of the standard library hashmap but there are some differences to due to the design of the hashmap.
Due to design limitations you cannot iterate over the map normally. Please use one of the below iterator functions to iterate over contained submaps and then iterate over those.
map.tables_read().for_each(|s| s.iter().for_each(|(k, v)| myfn(k, v)));
Methods
impl<'a, K: 'a, V: 'a> DHashMap<K, V> where
K: Hash + Eq,
[src]
K: Hash + Eq,
pub fn new() -> Self
[src]
Create a new DHashMap. Doesn't allocate space for elements until it starts filling up.
pub fn with_nonce(hash_nonce: u64) -> Self
[src]
Create a new DHashMap with a specified nonce. Not recommended.
pub fn insert(&self, key: K, value: V)
[src]
Insert an element into the map.
pub fn contains_key(&self, key: &K) -> bool
[src]
Check if the map contains the specified key.
pub fn get(&'a self, key: &'a K) -> Option<DHashMapRef<'a, K, V>>
[src]
Get a shared reference to an element contained within the map.
pub fn get_mut(&'a self, key: &'a K) -> Option<DHashMapRefMut<'a, K, V>>
[src]
Get a unique reference to an element contained within the map.
pub fn remove(&self, key: &K) -> Option<(K, V)>
[src]
Remove an element from the map if it exists. Will return the K, V pair.
pub fn retain<F: Clone + FnMut(&K, &mut V) -> bool>(&self, f: F)
[src]
Retain all elements that the specified function returns true
for.
pub fn clear(&self)
[src]
Clear all elements from the map.
pub fn tables_read(&self) -> impl Iterator<Item = SMRInterface<K, V>>
[src]
Iterate over submaps in a read only fashion.
pub fn tables_write(&self) -> impl Iterator<Item = SMRWInterface<K, V>>
[src]
Iterate over submaps in a read-write fashion.
pub fn determine_map(&self, key: &K) -> usize
[src]
Trait Implementations
Auto Trait Implementations
impl<K, V> Send for DHashMap<K, V> where
K: Send,
V: Send,
K: Send,
V: Send,
impl<K, V> Sync for DHashMap<K, V> where
K: Send + Sync,
V: Send + Sync,
K: Send + Sync,
V: Send + Sync,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Rfn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,