pub struct UnboundedSender<T> { /* private fields */ }
Expand description

The Sender-Half of an unbounded Queue

Implementations

Checks if the Queue has been closed by the Consumer

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

// Drop the Consumer and therefore also close the Queue
drop(rx);

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

Enqueues the Data

Example

Normal Enqueue, where the Queue is not closed

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

assert_eq!(Ok(()), tx.enqueue(13));

Failed Enqueue, the Queue has been closed

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

// Drop the Consumer and therefore also close the Queue
drop(rx);

assert_eq!(Err((13, EnqueueError::Closed)), tx.enqueue(13));

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

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.