pub trait Producer<T> {
// Required methods
fn capacity(&self) -> usize;
fn len(&self) -> usize;
fn maybe_push(&self, value: T) -> Result<(), T>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn free_slots(&self) -> usize { ... }
}Expand description
A producer of a queue.
Required Methods§
Sourcefn maybe_push(&self, value: T) -> Result<(), T>
fn maybe_push(&self, value: T) -> Result<(), T>
Pushes a value only if the queue is not full. It returns an error if the queue is full.
It may be non-lock-free.
Provided Methods§
Sourcefn free_slots(&self) -> usize
fn free_slots(&self) -> usize
Returns the number of free slots in the queue.