FlatVec

Type Alias FlatVec 

Source
pub type FlatVec<T, L = usize> = GenericVec<[MaybeInvalid<T>], L>;
Expand description

Growable flat vector of sized items.

It doesn’t allocate memory on the heap but instead stores its contents in the same memory behind itself.

Obviously, this type is DST.

Aliased Type§

pub struct FlatVec<T, L = usize> { /* private fields */ }

Trait Implementations§

Source§

impl<T, L> FlatBase for FlatVec<T, L>
where T: Flat + Sized, L: Flat + Length,

Source§

const ALIGN: usize

Align of the type.
Source§

const MIN_SIZE: usize = Self::DATA_OFFSET

Minimal size of an instance of the type.
Source§

fn size(&self) -> usize

Size of an instance of the type.
Source§

impl<T, L> FlatDefault for FlatVec<T, L>
where T: Flat + Sized, L: Flat + Length,

Source§

type DefaultEmplacer = Empty

Source§

fn default_emplacer() -> Empty

Initialize uninitialized memory into valid default state. Read more
Source§

fn default_in_place(bytes: &mut [u8]) -> Result<&mut Self, Error>

Create a new instance of Self initializing raw memory into default state of Self.
Source§

impl<T, L> FlatUnsized for FlatVec<T, L>
where T: Flat + Sized, L: Flat + Length,

Source§

type AlignAs = FlatVecAlignAs<T, L>

Sized type that has the same alignment as Self.
Source§

unsafe fn ptr_from_bytes(bytes: *mut [u8]) -> *mut Self

Source§

unsafe fn ptr_to_bytes(this: *mut Self) -> *mut [u8]

Source§

unsafe fn from_bytes_unchecked(bytes: &[u8]) -> &Self

Source§

unsafe fn from_mut_bytes_unchecked(bytes: &mut [u8]) -> &mut Self

Source§

fn as_bytes(&self) -> &[u8]

Source§

unsafe fn as_mut_bytes(&mut self) -> &mut [u8]

Safety Read more
Source§

fn new_in_place<I: Emplacer<Self>>( bytes: &mut [u8], emplacer: I, ) -> Result<&mut Self, Error>

Create a new instance of Self initializing raw memory into default state of Self.
Source§

fn assign_in_place<I: Emplacer<Self>>( &mut self, emplacer: I, ) -> Result<&mut Self, Error>

Source§

impl<T, L> FlatValidate for FlatVec<T, L>
where T: Flat + Sized, L: Flat + Length,

Source§

unsafe fn validate_unchecked(bytes: &[u8]) -> Result<(), Error>

Source§

unsafe fn validate_ptr(this: *const Self) -> Result<(), Error>

Source§

fn validate(bytes: &[u8]) -> Result<(), Error>

Check that memory contents of this is valid for Self.
Source§

fn from_bytes(bytes: &[u8]) -> Result<&Self, Error>

Source§

fn from_mut_bytes(bytes: &mut [u8]) -> Result<&mut Self, Error>

Source§

impl<T, L> Flat for FlatVec<T, L>
where T: Flat + Sized, L: Flat + Length,