pub trait Vector<T>: DerefMut<Target = [T]> {
    type Error: Debug;

    // Required methods
    fn reserve(&mut self, additional: usize) -> Result<(), Self::Error>;
    fn capacity(&self) -> usize;
    fn push(&mut self, item: T) -> Result<(), Self::Error>;
    fn clear(&mut self);
}
Expand description

Represents an abstract vector over a type accessible as mutable slice.

Required Associated Types§

Required Methods§

source

fn reserve(&mut self, additional: usize) -> Result<(), Self::Error>

Reserves memory for the given number of additional items in this vector.

source

fn capacity(&self) -> usize

Returns the number of items this vector is capable of storing.

source

fn push(&mut self, item: T) -> Result<(), Self::Error>

Pushes a new element to the end of this vector.

source

fn clear(&mut self)

Removes all elements from this vector.

Implementors§

source§

impl<T> Vector<T> for AllocVec<T>

source§

impl<T, const N: usize> Vector<T> for Array<T, N>