Crate arraydeque

source ·
Expand description

A circular buffer with fixed capacity. Requires Rust 1.59+

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 and Vec
    • Use libstd

§Usage

First, add the following to your Cargo.toml:

[dependencies]
arraydeque = "0.5"

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§

Modules§

  • Behavior semantics for ArrayDeque.

Structs§

Traits§

  • RangeArgument is implemented by Rust’s built-in range types, produced by range syntax like .., a.., ..b or c..d.