Skip to main content

Capacity

Trait Capacity 

Source
pub trait Capacity {
    // Required method
    fn capacity(&self) -> usize;
}
Expand description

Collection with known capacity.

Required Methods§

Source

fn capacity(&self) -> usize

Returns the current capacity of the collection.

This corresponds to the number of elements the collection can hold without reallocation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> Capacity for Vec<T>

Source§

fn capacity(&self) -> usize

Source§

impl<T> Capacity for VecDeque<T>

Source§

fn capacity(&self) -> usize

Implementors§