ProduceConsume

Trait ProduceConsume 

Source
pub trait ProduceConsume<T> {
    // Required methods
    fn produce(&mut self, data: T);
    fn consume(&mut self) -> Option<T>;
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
}
Expand description

Common trait for data structure usable as a producer-consumer medium.

Required Methods§

Source

fn produce(&mut self, data: T)

Produce a value.

This method adds a value into the object.

Source

fn consume(&mut self) -> Option<T>

Consume a value.

This method moves out a value from the object.

Source

fn len(&self) -> usize

Source

fn is_empty(&self) -> bool

Implementors§