arraysetcell/lib.rs
1//! `ArraySetCell` is a fixed-capacity, vector-like array with interior mutability
2//! and no ordering guarantees. Elements are stored as `Cell<Option<T>>`
3//!
4//! ```
5//! use std::cell::Cell;
6//! use arraysetcell::ArraySetCell;
7//!
8//! let mut array = ArraySetCell::<u32, 3>::from([Some(1), None, Some(3)]);
9//! assert_eq!(array.capacity(), 3);
10//! assert_eq!(array.len(), 2);
11//!
12//! array.push(10);
13//! assert_eq!(array.len(), 3);
14//!
15//! array.retain(|x| *x < 10);
16//! assert_eq!(array.len(), 2);
17//!
18//! let result = array.filter_mut(|x| if *x > 2 { Some(*x) } else { None });
19//! assert_eq!(result, Some(3));
20//!
21//! let mut iter = array.into_iter();
22//! assert_eq!(iter.size_hint(), (2, Some(2)));
23//! assert_eq!(iter.next(), Some(1));
24//! assert_eq!(iter.next(), Some(3));
25//! assert_eq!(iter.next(), None);
26//! ```
27
28mod array_set_cell;
29pub mod error;
30pub mod iter;
31
32pub use array_set_cell::ArraySetCell;