pub struct SyncHashMapB<K: Eq + Hash, V> { /* private fields */ }Implementations§
Source§impl<K: Eq + Hash, V> SyncHashMapB<K, V>
impl<K: Eq + Hash, V> SyncHashMapB<K, V>
pub fn new(bucket_count: Option<usize>) -> Self
Sourcepub fn insert(&self, k: K, v: V) -> Option<V>
pub fn insert(&self, k: K, v: V) -> Option<V>
use fast_able::{SyncHashMapB};
let mut map = SyncHashMapB::new(None);
map.insert(1, "a");
map.insert(2, "b");
assert_eq!(*map.get(&1).unwrap(), "a");
assert_eq!(map.get(&2).is_none(), false);
assert_eq!(map.get(&3).is_none(), true);pub fn insert_mut(&mut self, k: K, v: V) -> Option<V>
pub fn remove(&self, k: &K) -> Option<V>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn clear(&self)
Sourcepub fn get(&self, k: &K) -> Option<&V>
pub fn get(&self, k: &K) -> Option<&V>
Returns a reference to the value corresponding to the key.
The key may be any borrowed form of the map’s key type, but
Hash and Eq on the borrowed form must match those for
the key type.
Since reading a map is unlocked, it is very fast
test bench_sync_hash_map_read … bench: 8 ns/iter (+/- 0)
§Examples
use fast_able::{SyncHashMapB};
let mut map = SyncHashMapB::new(None);
map.insert_mut(1, "a");
assert_eq!(*map.get(&1).unwrap(), "a");
assert_eq!(map.get(&2).is_none(), true);pub fn get_mut(&self, k: &K) -> Option<SyncMapRefMut<'_, V>>
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for SyncHashMapB<K, V>
impl<K, V> !RefUnwindSafe for SyncHashMapB<K, V>
impl<K, V> Send for SyncHashMapB<K, V>
impl<K, V> Sync for SyncHashMapB<K, V>
impl<K, V> Unpin for SyncHashMapB<K, V>
impl<K, V> UnwindSafe for SyncHashMapB<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