| Crates.io | arraydeque |
| lib.rs | arraydeque |
| version | 0.5.1 |
| created_at | 2016-10-30 13:36:20.690439+00 |
| updated_at | 2023-02-05 09:45:24.217513+00 |
| description | A ring buffer with a fixed capacity, which can be stored on the stack. |
| homepage | https://github.com/andylokandy/arraydeque |
| repository | https://github.com/andylokandy/arraydeque |
| max_upload_size | |
| id | 7046 |
| size | 103,392 |
arraydequeA circular buffer with fixed capacity. Requires Rust 1.59+.
This crate is inspired by bluss/arrayvec
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 }
extern crate arraydeque;
use arraydeque::ArrayDeque;
fn main() {
let mut deque: ArrayDeque<_, 2> = ArrayDeque::new();
assert_eq!(deque.capacity(), 2);
assert_eq!(deque.len(), 0);
deque.push_back(1);
deque.push_back(2);
assert_eq!(deque.len(), 2);
assert_eq!(deque.pop_front(), Some(1));
assert_eq!(deque.pop_front(), Some(2));
assert_eq!(deque.pop_front(), None);
}
0.5.1 Make ArrayDeque::new() a const fn.
0.5.0 Support consnt generic capacity. Remove use_generic_array feature.
0.4.5 Update generic-array to 0.12.
0.4.4 Fix UB: Some(ArrayDeque::new(xs)).is_some() == false. (#12)
0.4.3 Add support for generic-array under use_generic_array feature.
0.4.1 Capacity now equal to backend_array.len().
0.3.1 Add behaviors: Saturating and Wrapping.
All kinds of contribution are welcomed.
Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)