Module trait_based_collection::queue
source · [−]Expand description
A collection of different implementations of a queue based on the FIFO
principle. There some
structs that implement the DequeCollection
trait, which allows them to be used as both
LIFO
and FIFO
queues.
Currently, the following implementations are available:
-
Standard Queue (Pure
FIFO
):Queue
: A linked queue based on nodes.
-
Double-ended Queue (
FIFO
andLIFO
):Deque
: A linked double-ended queue based on nodes.CircularDeque
: An array-based double-ended queue based on a circular array.
For more information, see the respective structs’ documentation.
For a pure LIFO
data structure, see the stack
module.
For a priority queue, see the priority_queue
module.
Structs
Iterator over the elements of a
CircularDeque
. This struct is created by the into_iter
method on CircularDeque
. See its documentation for more.An immutable iterator over the elements of a
CircularDeque
. This struct is created by the
iter
method on CircularDeque
. See its documentation for more.A mutable iterator over the elements of a
CircularDeque
. This struct is created by the
iter_mut
method on CircularDeque
. See its documentation for more.A double-ended queue. This data structure is a combination of a
Stack
and a Queue
. It
allows to push and pop elements from both ends of the queue. This data structure implements both
LIFO and FIFO. For more information, see the DequeCollection
trait.A queue is a collection that follows the FIFO (first-in-first-out) principle. This means that
elements are added to the back of the queue and removed from the front of the queue. This
implementation uses a linked-based structure.
Traits
Trait that encapsulates the common functionality of a double-ended queue. This means that the
queue can be used as both a
LIFO
and FIFO
queue. This trait is a sub-trait of the
Collection
trait, allowing to implement some default methods associated with a queue
collection (push_back
, pop_front
, peek_front
, peek_front_mut
, peek_back
,
peek_back_mut
).