pub struct KeyedQueues<K, V> { /* private fields */ }Expand description
HashMap<K, Arc<ConcurrentQueue<V>>> behind a single RwLock.
- Writers only contend when creating a new key.
pushis almost always non-blocking (unbounded queue).
Implementations§
Source§impl<K, V> KeyedQueues<K, V>
impl<K, V> KeyedQueues<K, V>
pub const fn new() -> Self
pub fn get_or_create(&self, key: &K) -> Arc<ConcurrentQueue<V>>
Sourcepub fn try_send(&self, key: &K, val: V) -> Result<(), PushError<V>>
pub fn try_send(&self, key: &K, val: V) -> Result<(), PushError<V>>
Potentially-blocking send but almost never blocking (unbounded queue => push never fails).
( Only blocks when the K has never been used before )
pub fn inner(&self) -> &RwLock<HashMap<K, Arc<ConcurrentQueue<V>>>>
Trait Implementations§
Auto Trait Implementations§
impl<K, V> !Freeze for KeyedQueues<K, V>
impl<K, V> !RefUnwindSafe for KeyedQueues<K, V>
impl<K, V> Send for KeyedQueues<K, V>
impl<K, V> Sync for KeyedQueues<K, V>
impl<K, V> Unpin for KeyedQueues<K, V>where
K: Unpin,
impl<K, V> UnsafeUnpin for KeyedQueues<K, V>
impl<K, V> UnwindSafe for KeyedQueues<K, V>where
K: 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