pub struct OptionalVec<T> { /* private fields */ }
Implementations§
Source§impl<T> OptionalVec<T>
impl<T> OptionalVec<T>
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Creates a new OptionalVec
with the given underlying capacity.
Sourcepub fn insert(&mut self, elem: T) -> usize
pub fn insert(&mut self, elem: T) -> usize
Inserts a new value either into the first existing hole or extending the vector of values, i.e. pushing it to its end.
Sourcepub fn next_idx(&self) -> usize
pub fn next_idx(&self) -> usize
Returns the index of the next value inserted into the OptionalVec
.
Sourcepub fn remove(&mut self, idx: usize) -> T
pub fn remove(&mut self, idx: usize) -> T
Removes a value at the specified index; assumes that the index points to
an existing value that is a Some(T)
(i.e. not a hole).
Trait Implementations§
Source§impl<T> Default for OptionalVec<T>
impl<T> Default for OptionalVec<T>
Source§impl<T> Index<usize> for OptionalVec<T>
impl<T> Index<usize> for OptionalVec<T>
Auto Trait Implementations§
impl<T> Freeze for OptionalVec<T>
impl<T> RefUnwindSafe for OptionalVec<T>where
T: RefUnwindSafe,
impl<T> Send for OptionalVec<T>where
T: Send,
impl<T> Sync for OptionalVec<T>where
T: Sync,
impl<T> Unpin for OptionalVec<T>where
T: Unpin,
impl<T> UnwindSafe for OptionalVec<T>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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more