pub struct ConcurrentHashMap<K, V> { /* private fields */ }Expand description
Thread-safe wrapper around HashMap
Implementations§
Source§impl<K: Clone + Eq + Hash, V: Clone> ConcurrentHashMap<K, V>
impl<K: Clone + Eq + Hash, V: Clone> ConcurrentHashMap<K, V>
Sourcepub fn insert(&self, key: K, value: V) -> UtilsResult<Option<V>>
pub fn insert(&self, key: K, value: V) -> UtilsResult<Option<V>>
Insert a key-value pair
Sourcepub fn get(&self, key: &K) -> UtilsResult<Option<V>>
pub fn get(&self, key: &K) -> UtilsResult<Option<V>>
Get a value by key
Sourcepub fn remove(&self, key: &K) -> UtilsResult<Option<V>>
pub fn remove(&self, key: &K) -> UtilsResult<Option<V>>
Remove a key-value pair
Sourcepub fn contains_key(&self, key: &K) -> UtilsResult<bool>
pub fn contains_key(&self, key: &K) -> UtilsResult<bool>
Check if key exists
Sourcepub fn len(&self) -> UtilsResult<usize>
pub fn len(&self) -> UtilsResult<usize>
Get the number of entries
Sourcepub fn is_empty(&self) -> UtilsResult<bool>
pub fn is_empty(&self) -> UtilsResult<bool>
Check if the map is empty
Trait Implementations§
Source§impl<K: Clone, V: Clone> Clone for ConcurrentHashMap<K, V>
impl<K: Clone, V: Clone> Clone for ConcurrentHashMap<K, V>
Source§fn clone(&self) -> ConcurrentHashMap<K, V>
fn clone(&self) -> ConcurrentHashMap<K, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more