Struct js_utils::queue::Queue

source ·
pub struct Queue<T> { /* private fields */ }
Expand description

FIFO queue with async pop.

Implementations§

Creates new queue with unbounded capacity.

Creates new queue with given capacity.

capacity must be greater than 0 - it’ll panic otherwise.

Pushes element into the queue.

If queue is full it will push out the last (oldest) element out of the queue.

Pops (asynchronously) element off the queue.

It means that if queue is currently empty await will wait till element is pushed into the queue.

Pops element off the queue.

Returns None if queue is currently empty.

Returns count of elements currently in the queue.

Returns true if queue is currently empty.

Returns true if queue is currently full.

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.