Trait syncbox::Queue [] [src]

pub trait Queue<T: Send> {
    fn poll(&self) -> Option<T>;
    fn is_empty(&self) -> bool;
    fn offer(&self, e: T) -> Result<(), T>;
}

An interface for queues of elements of type T.

Required Methods

fn poll(&self) -> Option<T>

Takes from the queue if there is an element available.

fn is_empty(&self) -> bool

Returns true if the queue contains no elements.

fn offer(&self, e: T) -> Result<(), T>

Adds the element e to the queue if possible.

Errors

A call to offer will fail if the queue is full; the provided element e is returned in the Err variant.

Implementors