pub struct MpscQueue<T> { /* private fields */ }Expand description
Multi-producer single-consumer linked queue.
Cloneable handles are not provided; share via Arc<MpscQueue<T>>.
Consumer methods (try_pop) require &mut self to encode single-consumer
invariant at the type level.
Implementations§
Source§impl<T> MpscQueue<T>
impl<T> MpscQueue<T>
pub fn new() -> Self
Sourcepub fn push(&self, value: T)
pub fn push(&self, value: T)
Multi-producer push. Wait-free for the producer once the node is allocated.
Sourcepub fn try_pop(&mut self) -> PopResult<T>
pub fn try_pop(&mut self) -> PopResult<T>
Consume one entry. Returns PopResult::Inconsistent if a producer
is mid-publish; callers should retry.
Single consumer only: requires &mut self.
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>
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