Type Definition coca::collections::AllocVec

source · []
pub type AllocVec<T, I = usize> = Vec<T, AllocStorage<ArrayLayout<T>>, I>;
This is supported on crate feature alloc only.
Expand description

A vector using a heap-allocated slice for storage.

Note this still has a fixed capacity, and will never reallocate.

Examples

let mut vec = coca::collections::AllocVec::<char>::with_capacity(3);
vec.push('a');
vec.push('b');
vec.push('c');
assert!(vec.try_push('d').is_err());

Implementations

Constructs a new, empty AllocVec<T, I> with the specified capacity.

Panics

Panics if the specified capacity cannot be represented by a usize.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more