Trait flex_alloc::vec::buffer::VecBuffer

source ·
pub trait VecBuffer: RawBuffer<RawData = Self::Data> {
    type Data;
    type Index: Index;

    // Required methods
    fn capacity(&self) -> Self::Index;
    fn length(&self) -> Self::Index;
    unsafe fn set_length(&mut self, len: Self::Index);
    fn vec_try_resize(
        &mut self,
        capacity: Self::Index,
        exact: bool,
    ) -> Result<(), StorageError>;

    // Provided methods
    fn as_uninit_slice(&mut self) -> &mut [MaybeUninit<Self::Data>] { ... }
    fn as_slice(&self) -> &[Self::Data] { ... }
    fn as_mut_slice(&mut self) -> &mut [Self::Data] { ... }
    unsafe fn uninit_index(
        &mut self,
        index: usize,
    ) -> &mut MaybeUninit<Self::Data> { ... }
}

Required Associated Types§

Required Methods§

source

fn capacity(&self) -> Self::Index

source

fn length(&self) -> Self::Index

source

unsafe fn set_length(&mut self, len: Self::Index)

§Safety

The capacity of the buffer must be established as greater than zero, otherwise this method may attempt to write into unallocated memory.

source

fn vec_try_resize( &mut self, capacity: Self::Index, exact: bool, ) -> Result<(), StorageError>

Provided Methods§

source

fn as_uninit_slice(&mut self) -> &mut [MaybeUninit<Self::Data>]

source

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

source

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

source

unsafe fn uninit_index(&mut self, index: usize) -> &mut MaybeUninit<Self::Data>

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, T: 'a, const N: usize> VecBuffer for InlineBuffer<T, N>

source§

impl<B, T, I: Index> VecBuffer for B
where B: AllocHandle<Meta = VecData<T, I>>,

source§

type Data = T

source§

type Index = I