Trait DynamicContainer

Source
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§

Source

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.

Source

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.

Source

fn capacity(&self) -> usize

Returns the number of elements the container can hold without reallocating.

Implementors§