pub struct ConcurrentHashTable<V, const N: usize> { /* private fields */ }Expand description
A hash table that shards to a constant number of tables to reduce lock contention
Implementations§
Source§impl<V, const N: usize> ConcurrentHashTable<V, N>
impl<V, const N: usize> ConcurrentHashTable<V, N>
pub fn new() -> Self
pub fn get(&self, key: u128) -> &RwLock<HashMap<u128, V>>
pub fn get_shard_at_idx(&self, idx: usize) -> Option<&RwLock<HashMap<u128, V>>>
pub fn read(&self, key: u128) -> RwLockReadGuard<'_, HashMap<u128, V>>
pub fn write(&self, key: u128) -> RwLockWriteGuard<'_, HashMap<u128, V>>
pub fn for_each<F>(&self, f: F)
Trait Implementations§
Auto Trait Implementations§
impl<V, const N: usize> !Freeze for ConcurrentHashTable<V, N>
impl<V, const N: usize> !RefUnwindSafe for ConcurrentHashTable<V, N>
impl<V, const N: usize> Send for ConcurrentHashTable<V, N>where
V: Send,
impl<V, const N: usize> Sync for ConcurrentHashTable<V, N>
impl<V, const N: usize> Unpin for ConcurrentHashTable<V, N>where
V: Unpin,
impl<V, const N: usize> UnwindSafe for ConcurrentHashTable<V, N>where
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