Expand description
A double-ended queue that can be sliced at any time without preparation.
§LinearDeque
vs VecDeque
§Slicing
The standard VecDeque
uses a ring buffer. It requires that the
make_contiguous
method is called to ensure that the deque content can
all be referenced in a single slice. make_contiguous
is only callable on
a mutable instance of the deque.
The LinearDeque
provided by this lib uses a linear buffer, keeping all
its content contiguous and allowing to have a slice with all the content at
any time, even when the deque is not mutable.
§Memory Usage
By using a ring buffer, all spare memory allocated by the standard
VecDeque
can be used for elements added at both the front and the back
ends.
Using a linear buffer, each end of the LinearDeque
have its own reserved
memory, so it tends to use more memory than VecDeque
.
Structs§
- Drain
- A draining iterator over the elements of a
LinearDeque
. - Into
Iter - An owning iterator over the elements of a
LinearDeque
. - Linear
Deque - A double-ended queue implemented with a growable linear buffer.
Enums§
- SetReserved
Space - Defines what happens to the reserved space of one of the deque ends on a call
to
set_reserved_space
.