pub struct InlineVec<T, const N: usize>(/* private fields */);
Expand description
A wrapper around a Vec<T>
that lives on the stack if it is small enough.
Implementations§
source§impl<T, const N: usize> InlineVec<T, N>
impl<T, const N: usize> InlineVec<T, N>
sourcepub fn is_heap_allocated(&self) -> bool
pub fn is_heap_allocated(&self) -> bool
Checks whether this vector is allocated on the heap
sourcepub fn inline_parts_mut(&mut self) -> Option<(&mut [MaybeUninit<T>; N], usize)>
pub fn inline_parts_mut(&mut self) -> Option<(&mut [MaybeUninit<T>; N], usize)>
If self
is inlined, this returns the underlying raw parts that make up this InlineVec
.
Only the first .1
elements are initialized.
sourcepub fn get(&self, index: usize) -> Option<&T>
pub fn get(&self, index: usize) -> Option<&T>
Returns a reference to the value at the given index
sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
Returns a mutable reference to the value at the given index
sourcepub fn remove(&mut self, index: usize) -> T
pub fn remove(&mut self, index: usize) -> T
Removes an element at a given index
§Panics
Just like Vec::remove
, this method will panic if the index is out of bounds.
sourcepub fn iter(&self) -> InlineVecIter<'_, T, N> ⓘ
pub fn iter(&self) -> InlineVecIter<'_, T, N> ⓘ
Returns an iterator over the elements of this vector
Trait Implementations§
Auto Trait Implementations§
impl<T, const N: usize> RefUnwindSafe for InlineVec<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for InlineVec<T, N>where
T: Send,
impl<T, const N: usize> Sync for InlineVec<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for InlineVec<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for InlineVec<T, N>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more