Struct nolock::queues::spsc::unbounded::UnboundedReceiver[][src]

pub struct UnboundedReceiver<T> { /* fields omitted */ }
Expand description

The Receiver-Half of an unbounded Queue

Implementations

Checks if the Queue has been closed by the Producer

Example

let (rx, tx) = unbounded::queue::<usize>();

// Dropping the Producer and therefore closing the Queue
drop(tx);

assert_eq!(true, rx.is_closed());

Attempts to dequeue a single Element from the Queue

Example

Successful Dequeue

let (mut rx, mut tx) = unbounded::queue::<usize>();

tx.enqueue(13).unwrap();

assert_eq!(Ok(13), rx.try_dequeue());

Dequeue on empty Queue

let (mut rx, mut tx) = unbounded::queue::<usize>();

assert_eq!(Err(DequeueError::WouldBlock), rx.try_dequeue());

A simple blocking dequeue operation. This is not lock-free anymore (obviously) and simply spins while trying to dequeue an element from the Queue until it succeeds

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.