pub struct AsyncShardedHashMap<K, V, S = FxBuildHasher>where
K: Eq + Hash + Clone + Send + Sync,
V: Clone + Send + Sync,
S: BuildHasher + Clone + Send + Sync,{ /* private fields */ }Available on crate feature
async only.Expand description
Asynchronous sharded concurrent HashMap (Tokio RwLock).
Implementations§
Source§impl<K, V> AsyncShardedHashMap<K, V, FxBuildHasher>
impl<K, V> AsyncShardedHashMap<K, V, FxBuildHasher>
Source§impl<K, V, S> AsyncShardedHashMap<K, V, S>
impl<K, V, S> AsyncShardedHashMap<K, V, S>
Sourcepub fn with_shards_and_hasher(shard_count: usize, hasher: S) -> Self
pub fn with_shards_and_hasher(shard_count: usize, hasher: S) -> Self
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Sourcepub async fn initialized_shards(&self) -> usize
pub async fn initialized_shards(&self) -> usize
Sourcepub async fn iter(&self) -> Vec<(K, V)>
pub async fn iter(&self) -> Vec<(K, V)>
Snapshot iteration (async).
Steps:
- Snapshot Arc list of initialized shards under read lock of the shard vector.
- For each shard: try
try_read; fallback toawaitread. - Clone inner HashMaps (short critical sections).
- If
rayonenabled, parallel flatten of snapshots.
Returns a materialized Vec.
Source§impl<K, V> AsyncShardedHashMap<K, V>
impl<K, V> AsyncShardedHashMap<K, V>
Sourcepub async fn async_snapshot_serializable(
&self,
) -> AsyncShardedHashMapSnapshot<K, V>
Available on crate feature serde only.
pub async fn async_snapshot_serializable( &self, ) -> AsyncShardedHashMapSnapshot<K, V>
serde only.Obtain a serializable snapshot wrapper (for serde).
Trait Implementations§
Source§impl<K, V, S> Clone for AsyncShardedHashMap<K, V, S>
impl<K, V, S> Clone for AsyncShardedHashMap<K, V, S>
Source§fn clone(&self) -> AsyncShardedHashMap<K, V, S>
fn clone(&self) -> AsyncShardedHashMap<K, V, S>
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, S> Freeze for AsyncShardedHashMap<K, V, S>where
S: Freeze,
impl<K, V, S = FxBuildHasher> !RefUnwindSafe for AsyncShardedHashMap<K, V, S>
impl<K, V, S> Send for AsyncShardedHashMap<K, V, S>
impl<K, V, S> Sync for AsyncShardedHashMap<K, V, S>
impl<K, V, S> Unpin for AsyncShardedHashMap<K, V, S>where
S: Unpin,
impl<K, V, S = FxBuildHasher> !UnwindSafe for AsyncShardedHashMap<K, V, S>
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