Struct nolock::queues::spsc::bounded::BoundedSender[][src]

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

The Sending-Half for the queue

Implementations

Returns whether or not the Queue has been closed by the Consumer

Example

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

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

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

Attempts to Enqueue the given piece of Data

Example:

Enqueue Data when there is still space

// Create a new Queue with the capacity for 16 Elements
let (mut rx, mut tx) = bounded::queue::<usize>(16);

// Enqueue some Data
assert_eq!(Ok(()), tx.try_enqueue(13));

Enqueue Data when there is no more space

// Create a new Queue with the capacity for 16 Elements
let (mut rx, mut tx) = bounded::queue::<usize>(16);

// Fill up the Queue
for i in 0..16 {
  assert_eq!(Ok(()), tx.try_enqueue(i));
}

// Attempt to enqueue some Data, but there is no more room
assert_eq!(Err((13, EnqueueError::WouldBlock)), tx.try_enqueue(13));

A blocking enqueue Operation. This is obviously not lock-free anymore and will simply spin while trying to enqueue the Data until it works

Checks if the current Queue is full

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.