containers-rs 0.5.1

'Collections' interfaces for describing objects that contain other objects
Documentation
/// Trait for a simple container.
pub trait Container {
    /// Get the size of the container.
    fn len(&self) -> usize;
}

/// Trait that represents dynamically growing containers.
pub trait DynamicContainer: Container {
    /// 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 reserve(&mut self, additional: usize);

    /// 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 shrink_to_fit(&mut self);

    /// Returns the number of elements the container can hold without reallocating.
    fn capacity(&self) -> usize;
}