pub type FastVec<T> = AutoVec<T, 16>;Expand description
A fast AutoVec with a stack capacity of 16 elements.
This is an alias for AutoVec<T, 16>.
FastVec is a balanced choice between stack efficiency and flexibility,
suitable for most general-purpose use cases. It can hold 16 elements on the stack
before spilling to the heap, making it ideal for collections that frequently stay small
but occasionally grow larger.
§Examples
let mut vec: FastVec<String> = FastVec::new();
// Moderate collections typically remain on the stack
vec.push("hello".to_string());
vec.push("world".to_string());
assert!(vec.in_stack());
// Can be extended up to 16 elements without heap allocation
for i in 0..14 {
vec.push(format!("item_{}", i));
}
assert!(vec.in_stack());
assert_eq!(vec.len(), 16);
// Beyond 16 elements, automatically uses heap
vec.push("beyond".to_string());
assert!(!vec.in_stack());Aliased Type§
pub struct FastVec<T>(/* private fields */);