pub struct ConcurrentMap<K, V> { /* private fields */ }Expand description
A thread-safe key-value map using DashMap.
Provides concurrent read/write access without explicit locking.
§Example
use spider_core::state::ConcurrentMap;
let map = ConcurrentMap::new();
map.insert("key".to_string(), 42);
assert_eq!(map.get(&"key".to_string()), Some(42));Implementations§
Source§impl<K, V> ConcurrentMap<K, V>
impl<K, V> ConcurrentMap<K, V>
Sourcepub fn new() -> ConcurrentMap<K, V>
pub fn new() -> ConcurrentMap<K, V>
Creates a new empty map.
Sourcepub fn with_capacity(capacity: usize) -> ConcurrentMap<K, V>
pub fn with_capacity(capacity: usize) -> ConcurrentMap<K, V>
Creates a map with the specified capacity.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Returns true if the map contains the key.
Trait Implementations§
Source§impl<K, V> Clone for ConcurrentMap<K, V>
impl<K, V> Clone for ConcurrentMap<K, V>
Source§fn clone(&self) -> ConcurrentMap<K, V>
fn clone(&self) -> ConcurrentMap<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 moreSource§impl<K, V> Debug for ConcurrentMap<K, V>
impl<K, V> Debug for ConcurrentMap<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for ConcurrentMap<K, V>
impl<K, V> !RefUnwindSafe for ConcurrentMap<K, V>
impl<K, V> Send for ConcurrentMap<K, V>
impl<K, V> Sync for ConcurrentMap<K, V>
impl<K, V> Unpin for ConcurrentMap<K, V>
impl<K, V> UnsafeUnpin for ConcurrentMap<K, V>
impl<K, V> UnwindSafe for ConcurrentMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
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