pub struct MpscQueue<T> { /* private fields */ }Expand description
Multiple-Producer Single-Consumer queue
Implemented as a Michael-Scott lock-free queue. Producers never block, the consumer can wait for data.
Implementations§
Source§impl<T> MpscQueue<T>
impl<T> MpscQueue<T>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a queue with a limited capacity
Sourcepub fn push(&self, value: T) -> QueueResult<()>
pub fn push(&self, value: T) -> QueueResult<()>
Push an element (can be called from multiple threads)
Trait Implementations§
impl<T: Send> Send for MpscQueue<T>
impl<T: Send> Sync for MpscQueue<T>
Auto Trait Implementations§
impl<T> !Freeze for MpscQueue<T>
impl<T> RefUnwindSafe for MpscQueue<T>
impl<T> Unpin for MpscQueue<T>
impl<T> UnsafeUnpin for MpscQueue<T>
impl<T> UnwindSafe for MpscQueue<T>where
T: RefUnwindSafe,
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