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

A handle to the queue which allows adding values onto the buffer

Implementations

Push a value onto the buffer.

If the buffer is non-full, the operation will execute immediately. If the buffer is full, this method will block until the buffer is non-full. The waiting strategy is a simple spin-wait. If you do not want a spin-wait burning CPU, you should call try_push() directly and implement a different waiting strategy.

Attempt to push a value onto the buffer.

This method does not block. If the queue is not full, the value will be added to the queue and the method will return None, signifying success. If the queue is full, this method will return Some(v)``, where v` is your original value.

Returns the total capacity of this queue

This value represents the total capacity of the queue when it is full. It does not represent the current usage. For that, call size().

Returns the current size of the queue

This value represents the current size of the queue. This value can be from 0-capacity inclusive.

Returns the available space in the queue

This value represents the number of items that can be pushed onto the queue before it becomes full.

Trait Implementations

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.