Trait ContainerReserve

Source
pub trait ContainerReserve {
    // Required method
    fn reserve(&mut self, additional: usize);
}
Expand description

A trait to reserve space in a container, in case you know how many values are about to enter and can avoid reallocations by reserving more space at once.

Required Methods§

Source

fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted in the cache. The collection may reserve more space to avoid frequent reallocations.

Implementations on Foreign Types§

Source§

impl<I, O, S> ContainerReserve for HashMap<I, O, S>
where I: Eq + Hash, S: BuildHasher,

Source§

fn reserve(&mut self, additional: usize)

Implementors§