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.

Checks if the current queue is empty

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.