[][src]Trait containers_rs::DynamicContainer

pub trait DynamicContainer: Container {
    fn reserve(&mut self, additional: usize);
fn shrink_to_fit(&mut self);
fn capacity(&self) -> usize; }

Trait that represents dynamically growing containers.

Required methods

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.

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.

fn capacity(&self) -> usize

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

Loading content...

Implementors

Loading content...