VecLike

Trait VecLike 

Source
pub unsafe trait VecLike {
    type T;

    // Required methods
    fn len(&self) -> usize;
    fn capacity(&self) -> usize;
    fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<Self::T>];
    unsafe fn set_len(&mut self, new_len: usize);

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Like vec struct trait

§Safety

Required Associated Types§

Source

type T

Required Methods§

Source

fn len(&self) -> usize

Vec initialized elements length

Source

fn capacity(&self) -> usize

Vec capacity

Source

fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<Self::T>]

Vec uninitialized partials

Source

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

This is lower operation

§Safety
  • new_len must be less than or equal capacity
  • old_len..new_len must be initialized

Provided Methods§

Source

fn is_empty(&self) -> bool

Return collection is empty

Implementations on Foreign Types§

Source§

impl<T> VecLike for Vec<T>

Source§

type T = T

Source§

fn len(&self) -> usize

Source§

fn capacity(&self) -> usize

Source§

fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<Self::T>]

Source§

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

Implementors§

Source§

impl<T, V: VecLike<T = T>> VecLike for TailVec<'_, T, V>

Source§

type T = T