Expand description
§Ad-hoc stack vectors
This crate defines the macro stack![]
, which can be used to create ad-hoc Vec<T>
like structs of a specific compile-time size on the stack.
These structs never allocate on the heap, and expose an API similar to Vec<T>
.
§Usage
The macro can be used like vec!
, with optional type inference.
let mut sv = stack![100]; // Implicitly typed.
sv.push(10usize);
let sv = stack![usize; 100]; // Explicitly typed, circumvents that error.
To see documentation of the types themselves, see one of the pre-defined StackVec
types in the crate’s root.
§Pre-defined types
StackVec
types of powers of 2 up until 4096 are defined in this crate too.
You can use the macro to create your own named non-opaque StackVec
types as well.
stack!(pub type S10Elements S10IntoIter 10); // A `StackVec` type with a capacity of 10.
Macros§
- stack
- Create an ad-hoc sized
Vec
-like array on the stack.
Structs§
- Stack
Vec1 - A sized stack vector
- Stack
Vec2 - A sized stack vector
- Stack
Vec4 - A sized stack vector
- Stack
Vec8 - A sized stack vector
- Stack
Vec1 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec2 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec4 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec8 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec16 - A sized stack vector
- Stack
Vec32 - A sized stack vector
- Stack
Vec64 - A sized stack vector
- Stack
Vec16 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec32 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec64 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec128 - A sized stack vector
- Stack
Vec256 - A sized stack vector
- Stack
Vec512 - A sized stack vector
- Stack
Vec128 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec256 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec512 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec1024 - A sized stack vector
- Stack
Vec2048 - A sized stack vector
- Stack
Vec4096 - A sized stack vector
- Stack
Vec1024 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec2048 Into Iter - Consuming iterator type for a
StackVec
- Stack
Vec4096 Into Iter - Consuming iterator type for a
StackVec