pub trait Consumer<T> {
// Required methods
fn capacity(&self) -> usize;
fn len(&self) -> usize;
fn pop_many(&self, dst: &mut [MaybeUninit<T>]) -> usize;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn pop(&self) -> Option<T> { ... }
fn steal_into(&self, dst: &impl SingleProducer<T>) -> usize { ... }
}Expand description
A consumer of a queue.
Required Methods§
Sourcefn pop_many(&self, dst: &mut [MaybeUninit<T>]) -> usize
fn pop_many(&self, dst: &mut [MaybeUninit<T>]) -> usize
Pops many values from the queue and returns the number of read values.
It may be non-lock-free.
Provided Methods§
Sourcefn pop(&self) -> Option<T>
fn pop(&self) -> Option<T>
Pops a value from the queue and returns it.
It may be non-lock-free.
Sourcefn steal_into(&self, dst: &impl SingleProducer<T>) -> usize
fn steal_into(&self, dst: &impl SingleProducer<T>) -> usize
Steals some values from the consumer and places them into dst.
Returns the number of stolen values.
It requires that the other queue to be empty. Expected to steal the half of the queue, but other implementations may steal another number of values.
It may be non-lock-free.
§Panics
Panics if the other queue is not empty.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.