Trait arrayvec::arrayvec_impl::ArrayVecImpl

source ·
pub(crate) trait ArrayVecImpl {
    type Item;

    const CAPACITY: usize;

    // Required methods
    fn len(&self) -> usize;
    unsafe fn set_len(&mut self, new_len: usize);
    fn as_ptr(&self) -> *const Self::Item;
    fn as_mut_ptr(&mut self) -> *mut Self::Item;

    // Provided methods
    fn as_slice(&self) -> &[Self::Item] { ... }
    fn as_mut_slice(&mut self) -> &mut [Self::Item] { ... }
    fn push(&mut self, element: Self::Item) { ... }
    fn try_push(
        &mut self,
        element: Self::Item,
    ) -> Result<(), CapacityError<Self::Item>> { ... }
    unsafe fn push_unchecked(&mut self, element: Self::Item) { ... }
    fn pop(&mut self) -> Option<Self::Item> { ... }
    fn clear(&mut self) { ... }
    fn truncate(&mut self, new_len: usize) { ... }
}
Expand description

Implements basic arrayvec methods - based on a few required methods for length and element access.

Required Associated Types§

Required Associated Constants§

Required Methods§

source

fn len(&self) -> usize

source

unsafe fn set_len(&mut self, new_len: usize)

source

fn as_ptr(&self) -> *const Self::Item

Return a raw pointer to the vector’s buffer.

source

fn as_mut_ptr(&mut self) -> *mut Self::Item

Return a raw mutable pointer to the vector’s buffer.

Provided Methods§

source

fn as_slice(&self) -> &[Self::Item]

Return a slice containing all elements of the vector.

source

fn as_mut_slice(&mut self) -> &mut [Self::Item]

Return a mutable slice containing all elements of the vector.

source

fn push(&mut self, element: Self::Item)

source

fn try_push( &mut self, element: Self::Item, ) -> Result<(), CapacityError<Self::Item>>

source

unsafe fn push_unchecked(&mut self, element: Self::Item)

source

fn pop(&mut self) -> Option<Self::Item>

source

fn clear(&mut self)

source

fn truncate(&mut self, new_len: usize)

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, const CAP: usize> ArrayVecImpl for ArrayVec<T, CAP>

§

type Item = T

source§

const CAPACITY: usize = CAP