Struct syncbox::LinkedQueue [] [src]

pub struct LinkedQueue<T: Send> {
    // some fields omitted
}

A queue in which values are contained by a linked list.

The current implementation is based on a mutex and two condition variables. It is also mostly a placeholder until a lock-free version is implemented, so it has not been tuned for performance.

Methods

impl<T: Send> LinkedQueue<T>

fn new() -> LinkedQueue<T>

Constructs a new, empty LinkedQueue<T> with capacity usize::MAX.

fn with_capacity(capacity: usize) -> LinkedQueue<T>

Constructs a new, empty LinkedQueue<T> with the specified capacity.

fn len(&self) -> usize

Returns the number of elements in the queue.

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.

fn offer_ms(&self, e: T, ms: u32) -> Result<(), T>

Adds the element e to the queue, blocking for up to ms milliseconds.

Errors

A call to offer_ms will fail if the element cannot be added within the timeout; the provided element e is returned in the Err variant.

fn put(&self, e: T)

Adds the element e to the queue, blocking until it can be added.

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

Takes from the queue if there is an element available.

fn poll_ms(&self, ms: u32) -> Option<T>

Takes from the queue, blocking for up to ms milliseconds.

fn take(&self) -> T

Takes from the queue, blocking until there is an element available.

Trait Implementations

impl<T: Send> Queue<T> for LinkedQueue<T>

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

fn is_empty(&self) -> bool

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

impl<T: Send> SyncQueue<T> for LinkedQueue<T>

fn take(&self) -> T

fn put(&self, e: T)

impl<T: Send> Clone for LinkedQueue<T>

fn clone(&self) -> LinkedQueue<T>

1.0.0fn clone_from(&mut self, source: &Self)