pub trait Reserve {
// Required method
fn reserve_with_storage(&mut self, n: usize, storage_n: usize);
// Provided method
fn reserve(&mut self, n: usize) { ... }
}Expand description
A trait that allows the container to allocate additional space without
changing any of the data. The container should allocate space for at least
n additional elements.
Composite collections such a Chunked or Select may choose to only
reserve primary level storage if the amount of total storage required cannot
be specified by a single number in reserve. This is the default behaviour
of the reserve function below. The reserve_with_storage method allows
the caller to also specify the amount of storage needed for the container at
the lowest level.