Struct nolock::queues::spsc::bounded::BoundedReceiver [−][src]
pub struct BoundedReceiver<T> { /* fields omitted */ }
Expand description
The Receiving-Half for the Queue
Implementations
Checks if the Queue has been closed by the Producer
Note
Even when this indicates that the Queue has been closed, there might still be Items in the Queue left that should first be dequeued by the Consumer before discarding the entire Queue
Example
let (rx, tx) = bounded::queue::<usize>(3); // Drop the Producer and therefore also close the Queue drop(tx); assert_eq!(true, rx.is_closed());
Attempts to Dequeue a single Element from the Queue
Example
There was something to dequeu
// Create a new Queue with the Capacity for 16-Elements let (mut rx, mut tx) = bounded::queue::<usize>(16); // Enqueue the Element tx.try_enqueue(13); // Dequeue the Element again assert_eq!(Ok(13), rx.try_dequeue());
The Queue is empty and therefore nothing could be dequeued
// Create a new Queue with the Capacity for 16-Elements let (mut rx, mut tx) = bounded::queue::<usize>(16); // Dequeue the Element again assert_eq!(Err(DequeueError::WouldBlock), rx.try_dequeue());
A blocking dequeue operations. This is not lock-free anymore and simply spins while trying to dequeue until it works.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for BoundedReceiver<T>
impl<T> Unpin for BoundedReceiver<T>
impl<T> !UnwindSafe for BoundedReceiver<T>