RPQueue

Trait RPQueue 

Source
pub trait RPQueue<'a, T> {
    // Required methods
    fn capacity(&self) -> usize;
    fn available(&self) -> usize;
    fn take(&self) -> Option<&'a mut T>;
    fn take_wait(&self, timeout: Duration) -> Option<&'a mut T>;
    fn offer(&self, item: &'a T) -> usize;
}
Expand description

RPQueue trait for pool queues

Required Methods§

Source

fn capacity(&self) -> usize

Returns the size of the queue in total number objects originally allocated

Source

fn available(&self) -> usize

Returns the number of available items in the buffer

Source

fn take(&self) -> Option<&'a mut T>

Returns an object from the queue or None if the pool is empty available. This method is preferred over take_wait when empty or near empty pools are common.

Source

fn take_wait(&self, timeout: Duration) -> Option<&'a mut T>

Returns an object from the queue or block until one is available

Source

fn offer(&self, item: &'a T) -> usize

Returns an object to the pool.

Implementors§

Source§

impl<'a, T> RPQueue<'a, T> for AtomicQueue<'a, T>

Source§

impl<'a, T> RPQueue<'a, T> for BlockingQueue<'a, T>