Crate arraydeque[−][src]
A circular buffer with fixed capacity. Requires Rust 1.20+
It can be stored directly on the stack if needed.
This queue has O(1)
amortized inserts and removals from both ends of the
container. It also has O(1)
indexing like a vector. The contained elements
are not required to be copyable
This crate is inspired by bluss/arrayvec
Feature Flags
The arraydeque crate has the following cargo feature flags:
-
std
- Optional, enabled by default
- Conversions between
ArrayDeque
andVec
- Use libstd
-
use_generic_array
- Optional
- Allow to use
GenericArray
Usage
First, add the following to your Cargo.toml
:
[dependencies]
arraydeque = "0.4"
Next, add this to your crate root:
extern crate arraydeque;
Currently arraydeque by default links to the standard library, but if you would
instead like to use arraydeque in a #![no_std]
situation or crate you can
request this via:
[dependencies]
arraydeque = { version = "0.4", default-features = false }
Behaviors
ArrayDeque
provides two different behaviors, Saturating
and Wrapping
,
determining whether to remove existing element automatically when pushing
to a full deque.
See the behavior module documentation for more.
Re-exports
pub use behavior::Saturating; |
pub use behavior::Wrapping; |
Modules
behavior | Behavior semantics for |
Structs
ArrayDeque | A fixed capacity ring buffer. |
CapacityError | Error value indicating insufficient capacity |
Drain | Draining |
IntoIter | By-value |
Iter |
|
IterMut |
|
Traits
Array | Trait for fixed size arrays. |
RangeArgument | RangeArgument is implemented by Rust’s built-in range types, produced
by range syntax like |