pub trait DynamicContainer: Container {
// Required methods
fn reserve(&mut self, additional: usize);
fn shrink_to_fit(&mut self);
fn capacity(&self) -> usize;
}
Expand description
Trait that represents dynamically growing containers.
Required Methods§
Sourcefn reserve(&mut self, additional: usize)
fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
more elements to be
inserted in the container. The collection may reserve more space to avoid
frequent reallocations.
Sourcefn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
Shrinks the capacity of the container as much as possible. It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.