pub trait VecHelper<T> {
// Required methods
fn alloc(&mut self) -> Allocation<'_, T>;
fn entry(&mut self, index: usize) -> VecEntry<'_, T>;
fn take(&mut self) -> Self;
fn take_and_preallocate(&mut self) -> Self;
}
Required Methods§
sourcefn alloc(&mut self) -> Allocation<'_, T>
fn alloc(&mut self) -> Allocation<'_, T>
Growns the vector by a single entry, returning the allocation.
sourcefn entry(&mut self, index: usize) -> VecEntry<'_, T>
fn entry(&mut self, index: usize) -> VecEntry<'_, T>
Either returns an existing elemenet, or grows the vector by one. Doesn’t expect indices to be higher than the current length.
sourcefn take_and_preallocate(&mut self) -> Self
fn take_and_preallocate(&mut self) -> Self
Functionally equivalent to mem::replace(&mut vec, Vec::new())
but tries
to keep the allocation in the caller if it is empty or replace it with a
pre-allocated vector.
Object Safety§
This trait is not object safe.