[][src]Struct deadqueue::limited::Queue

pub struct Queue<T> { /* fields omitted */ }

Queue that is limited in size and does not support resizing.

This queue implementation has the following characteristics:

  • Based on crossbeam_queue::ArrayQueue
  • Has limit capacity with back pressure on push
  • Does not support resizing
  • Enabled via the limited feature in your Cargo.toml

Methods

impl<T> Queue<T>[src]

pub fn new(max_size: usize) -> Self[src]

Create new empty queue

pub async fn pop<'_>(&'_ self) -> T[src]

Get an item from the queue. If the queue is currently empty this method blocks until an item is available.

pub fn try_pop(&self) -> Option<T>[src]

Try to get an item from the queue. If the queue is currently empty return None instead.

pub async fn push<'_>(&'_ self, item: T)[src]

Push an item into the queue

pub fn try_push(&self, item: T) -> Result<(), T>[src]

Try to push an item into the queue. If the queue is full the item is returned as Err<T>.

pub fn capacity(&self) -> usize[src]

Get capacity of the queue

pub fn len(&self) -> usize[src]

Get current length of queue

pub fn available(&self) -> isize[src]

The number of available items in the queue. If there are no items in the queue this number can become negative and stores the number of futures waiting for an item.

Trait Implementations

impl<T, I> From<I> for Queue<T> where
    I: IntoIterator<Item = T>,
    <I as IntoIterator>::IntoIter: ExactSizeIterator
[src]

fn from(iter: I) -> Self[src]

Create new queue from the given exact size iterator of objects.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Queue<T>

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

impl<T> Sync for Queue<T> where
    T: Send

impl<T> Unpin for Queue<T> where
    T: Unpin

impl<T> !UnwindSafe for Queue<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.