pub struct OptArrayVec<T, const N: usize> { /* private fields */ }Expand description
A vector-like container that does not store its length directly, but rather retrieves them through inner options
I highly discourage using this if size_of::<Yourtype> != size_of::<Option<Yourtype>>
Implementations§
Source§impl<T, const CAP: usize> OptArrayVec<T, CAP>
impl<T, const CAP: usize> OptArrayVec<T, CAP>
pub fn cap(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new empty vec CAP must be provided for how many elements can be stored
Sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Removes last element from the vec and return it If the vec is empty None is returned instead
Sourcepub fn into_inner(self) -> [Option<T>; CAP]
pub fn into_inner(self) -> [Option<T>; CAP]
Returns contents as they are stored internally
Sourcepub fn remaining_capacity(&self) -> usize
pub fn remaining_capacity(&self) -> usize
Returns capacity still remaining
Trait Implementations§
Source§impl<T: Clone, const N: usize> Clone for OptArrayVec<T, N>
impl<T: Clone, const N: usize> Clone for OptArrayVec<T, N>
Source§fn clone(&self) -> OptArrayVec<T, N>
fn clone(&self) -> OptArrayVec<T, N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, const CAP: usize> Default for OptArrayVec<T, CAP>
impl<T, const CAP: usize> Default for OptArrayVec<T, CAP>
Source§impl<T, const CAP: usize> Extend<T> for OptArrayVec<T, CAP>
impl<T, const CAP: usize> Extend<T> for OptArrayVec<T, CAP>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Appends iterator to Self
§Panics
When the iterator yields more elements than there is remaining space
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<T, const CAP: usize> FromIterator<T> for OptArrayVec<T, CAP>
impl<T, const CAP: usize> FromIterator<T> for OptArrayVec<T, CAP>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Source§impl<'a, T, const CAP: usize> IntoIterator for &'a OptArrayVec<T, CAP>
impl<'a, T, const CAP: usize> IntoIterator for &'a OptArrayVec<T, CAP>
Source§impl<T, const CAP: usize> IntoIterator for OptArrayVec<T, CAP>
impl<T, const CAP: usize> IntoIterator for OptArrayVec<T, CAP>
impl<T: Copy, const N: usize> Copy for OptArrayVec<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for OptArrayVec<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for OptArrayVec<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for OptArrayVec<T, N>where
T: Send,
impl<T, const N: usize> Sync for OptArrayVec<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for OptArrayVec<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for OptArrayVec<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