Struct flatvec::FlatVec [−][src]
pub struct FlatVec<T, IndexTy: Default, BackingTy, const INDEX_INLINE_LEN: usize> { /* fields omitted */ }
Expand description
An indirection-collapsing container with minimal allocation
Read as “An internally-flattening Vec of T, indexed by IndexTy
, where each T
is stored as a
slice of BackingTy
”
For simple use cases, you may want a type alias for FlatVec<T, usize, u8, 3>
, but under some
workloads it is very profitable to pick a smaller IndexTy
, possibly even u8
, and a
corresponding inline capacity.
Implementations
Create a new FlatVec
, this is just an alias for the Default
implementation.
Returns the number of BackingTy
used to store the elements of a FlatVec
. This does not
necessarily correlate with storage used to store the indices.
Appends an element to the back of the collection.
Construct a Dest
from the index
th element’s stored representation.
impl<'a, T: 'a, IndexTy, BackingTy, const INDEX_INLINE_LEN: usize> FlatVec<T, IndexTy, BackingTy, INDEX_INLINE_LEN> where
IndexTy: Default,
IndexTy: TryFrom<usize> + Copy + Sub,
usize: TryFrom<IndexTy>,
<IndexTy as TryFrom<usize>>::Error: Debug,
<usize as TryFrom<IndexTy>>::Error: Debug,
BackingTy: Copy,
impl<'a, T: 'a, IndexTy, BackingTy, const INDEX_INLINE_LEN: usize> FlatVec<T, IndexTy, BackingTy, INDEX_INLINE_LEN> where
IndexTy: Default,
IndexTy: TryFrom<usize> + Copy + Sub,
usize: TryFrom<IndexTy>,
<IndexTy as TryFrom<usize>>::Error: Debug,
<usize as TryFrom<IndexTy>>::Error: Debug,
BackingTy: Copy,
Trait Implementations
Auto Trait Implementations
impl<T, IndexTy, BackingTy, const INDEX_INLINE_LEN: usize> RefUnwindSafe for FlatVec<T, IndexTy, BackingTy, INDEX_INLINE_LEN> where
BackingTy: RefUnwindSafe,
IndexTy: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, IndexTy, BackingTy, const INDEX_INLINE_LEN: usize> Send for FlatVec<T, IndexTy, BackingTy, INDEX_INLINE_LEN> where
BackingTy: Send,
IndexTy: Send,
T: Send,
impl<T, IndexTy, BackingTy, const INDEX_INLINE_LEN: usize> Sync for FlatVec<T, IndexTy, BackingTy, INDEX_INLINE_LEN> where
BackingTy: Sync,
IndexTy: Sync,
T: Sync,
impl<T, IndexTy, BackingTy, const INDEX_INLINE_LEN: usize> Unpin for FlatVec<T, IndexTy, BackingTy, INDEX_INLINE_LEN> where
IndexTy: Unpin,
T: Unpin,
impl<T, IndexTy, BackingTy, const INDEX_INLINE_LEN: usize> UnwindSafe for FlatVec<T, IndexTy, BackingTy, INDEX_INLINE_LEN> where
BackingTy: UnwindSafe,
IndexTy: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more