Trait toad_common::array::Reserve
source · pub trait Reserve: Default {
// Provided method
fn reserve(_: usize) -> Self { ... }
}
Expand description
Create a data structure and reserve some amount of space for it to grow into
Examples
Vec
isReserve
, and invokesVec::with_capacity
tinyvec::ArrayVec
isReserve
and invokesDefault::default()
because creating anArrayVec
automatically allocates the required space on the stack.
Provided Methods§
sourcefn reserve(_: usize) -> Self
fn reserve(_: usize) -> Self
Create an instance of the collection with a given capacity.
Used to reserve some contiguous space, e.g. Vec::with_capacity
The default implementation invokes Default::default