Expand description
§arrlist
A generic, heap-allocated dynamic array for no_std environments.
ArrayList<T> is a contiguous, growable collection backed by a boxed slice of
MaybeUninit<T>. It provides O(1) amortized push/pop at the
back, O(n) insertion and removal at arbitrary positions, and a full set of
iterator types — all without requiring the standard library.
§Features
no_stdcompatible (requiresalloc)- Manual memory management via
MaybeUninit— no unnecessaryDefaultbounds - Amortized O(1)
pushandpop - O(n)
insert,remove, andpop_front - Conversion from
Vec<T>,[T; N], and&[T] - Owned, shared, and mutable iterators
- Built-in
sort(bubble sort),reverse,linear_search, andbinary_search
§Quick Start
use arrlist::{arrlist, ArrayList};
// Using the macro — just like vec![]
let list = arrlist![1, 2, 3];
assert_eq!(list.len(), 3);
assert_eq!(list.get(1), Some(&2));
// Or create an empty list with a given capacity: arrlist![0; 8]
let list: ArrayList<i32> = arrlist![0; 8];
assert_eq!(list.capacity(), 8);
assert_eq!(list.len(), 8);Modules§
Macros§
- arrlist
- Creates an
ArrayListwith the given elements, mirroring the syntax of the standardvec!macro.
Structs§
- Array
List - Core
ArrayList<T>data structure. A heap-allocated, dynamically-sized list backed by a contiguous block of memory. - Into
Iter - An owning iterator over an
ArrayList<T>. - Iter
- A borrowing iterator over an
ArrayList<T>that yields shared references. - IterMut
- A mutably-borrowing iterator over an
ArrayList<T>that yields exclusive references.