pub struct ConcurrentHashMap<K, V> { /* private fields */ }
Implementations§
Source§impl<K, V> ConcurrentHashMap<K, V>
impl<K, V> ConcurrentHashMap<K, V>
pub fn new() -> Self
pub fn get_inner(&self) -> Arc<RwLock<HashMap<K, V>>>
pub fn get_inner_rl(&self) -> RwLockReadGuard<'_, HashMap<K, V>>
pub fn get_inner_wl(&self) -> RwLockWriteGuard<'_, HashMap<K, V>>
pub fn get_or_insert( &self, key: &K, value_gen_fn: impl Fn(&K) -> Result<V, SmallError>, ) -> Result<V, SmallError>
pub fn alter_value( &self, key: &K, alter_fn: impl Fn(&mut V) -> Result<(), SmallError>, ) -> Result<(), SmallError>
Sourcepub fn exact_or_empty(&self, k: &K, v: &V) -> bool
pub fn exact_or_empty(&self, k: &K, v: &V) -> bool
Return true if map[&k] == v
, or map[&k]
is not exist.
Return false if map[&k] != v
.
pub fn clear(&self)
pub fn remove(&self, key: &K) -> Option<V>
pub fn insert(&self, key: K, value: V) -> Option<V>
pub fn keys(&self) -> Vec<K>
Auto Trait Implementations§
impl<K, V> Freeze for ConcurrentHashMap<K, V>
impl<K, V> RefUnwindSafe for ConcurrentHashMap<K, V>
impl<K, V> Send for ConcurrentHashMap<K, V>
impl<K, V> Sync for ConcurrentHashMap<K, V>
impl<K, V> Unpin for ConcurrentHashMap<K, V>
impl<K, V> UnwindSafe for ConcurrentHashMap<K, V>
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