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 and LIFO):

    • 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

A circular deque capable of expanding its capacity when needed. It is implemented using Vec, so the elements are stored contiguously in memory. The main difference between this and a Deque is that this one does not use nodes. This data structure implements both LIFO and FIFO.
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.
Iterator over the elements of a Deque. This struct is created by the into_iter method on Deque. See its documentation for more.
An immutable iterator over the elements of a Deque. This struct is created by the iter method on Deque. See its documentation for more.
A mutable iterator over the elements of a Deque. This struct is created by the iter_mut method on Deque. See its documentation for more.
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.
Iterator over the elements of a Queue. This struct is created by the into_iter method on Queue. See its documentation for more.
An immutable iterator over the elements of a Queue. This struct is created by the iter method on Queue. See its documentation for more.
A mutable iterator over the elements of a Queue. This struct is created by the iter_mut method on Queue. See its documentation for more.

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).