[−][src]Type Definition coca::vec::AllocVec
type AllocVec<E, I = usize> = Vec<E, HeapStorage<E>, I>;
This is supported on crate feature
alloc
only.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::AllocVec::<char>::with_capacity(3); vec.push('a'); vec.push('b'); vec.push('c'); assert!(vec.try_push('d').is_err());
Implementations
impl<E, I> AllocVec<E, I> where
E: Copy,
I: Capacity,
[src]
E: Copy,
I: Capacity,
pub fn with_capacity(capacity: I) -> Self
[src]
Constructs a new, empty AllocVec<E, I>
with the specified capacity.
Panics
Panics if the specified capacity cannot be represented by a usize
.