[−][src]Struct deadqueue::limited::Queue
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 yourCargo.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]
I: IntoIterator<Item = T>,
<I as IntoIterator>::IntoIter: ExactSizeIterator,
Auto Trait Implementations
impl<T> !RefUnwindSafe for Queue<T>
impl<T> Send for Queue<T> where
T: Send,
T: Send,
impl<T> Sync for Queue<T> where
T: Send,
T: Send,
impl<T> Unpin for Queue<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for Queue<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,