Struct snarkvm_algorithms::r1cs::OptionalVec
source · 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> 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