Trait AnyVec

Source
pub trait AnyVec<T>
where Self: Default + AsRef<[T]> + AsMut<[T]> + IntoIterator<Item = T>,
{ // Required methods fn extend(&mut self, elements: &[T]) -> Result<(), MemoryError> where T: Clone; fn insert(&mut self, index: usize, element: T) -> Result<(), MemoryError>; // Provided methods fn new(elements: &[T]) -> Result<Self, MemoryError> where T: Clone { ... } fn push(&mut self, element: T) -> Result<(), MemoryError> { ... } }
Expand description

A bridge trait to unify required vector operations over multiple implementations

Required Methods§

Source

fn extend(&mut self, elements: &[T]) -> Result<(), MemoryError>
where T: Clone,

Extends the vector from the given elements

Source

fn insert(&mut self, index: usize, element: T) -> Result<(), MemoryError>

Inserts the given element at the given index

Provided Methods§

Source

fn new(elements: &[T]) -> Result<Self, MemoryError>
where T: Clone,

Creates a new vector by copying the given elements

Source

fn push(&mut self, element: T) -> Result<(), MemoryError>

Pushes an element to the end of the vector

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, const CAP: usize> AnyVec<T> for Vec<T, CAP>

Source§

fn insert(&mut self, index: usize, element: T) -> Result<(), MemoryError>

Source§

fn extend(&mut self, elements: &[T]) -> Result<(), MemoryError>
where T: Clone,

Implementors§