pub struct Receiver<T>(_);
Expand description

The receiving Half for a NCQ based MPMC-Queue

Implementations

Attempts to dequeue an Item from the Queue

Example
Successfully enqueue Element
let (rx, tx) = ncq::queue::<u64>(10);

// Enqueue an Item
tx.try_enqueue(13).unwrap();

// Dequeue the Item
assert_eq!(Ok(13), rx.try_dequeue());
Enqueue from empty Queue
let (rx, tx) = ncq::queue::<u64>(10);

// Attempt to Dequeue an item
assert_eq!(Err(DequeueError::Empty), rx.try_dequeue());

Checks if the Sending Half has closed the Queue, meaning that no more new Elements will be added to the Queue.

Note

Even if this indicates that the Queue has been closed, by the Sender and no more new Elements will be inserted into the Queue, there might still be Elements left in the Queue that are waiting to be dequeued.

Example
let (rx, tx) = ncq::queue::<u64>(10);

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

tx.try_enqueue(13).unwrap();
drop(tx);

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

Trait Implementations

Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.