Trait MutableZeroVecLike
trait MutableZeroVecLike<'a, T: ?Sized>: ZeroVecLike<T>
Trait abstracting over ZeroVec and VarZeroVec, for use in ZeroMap. You
should not be implementing or calling this trait directly.
This trait augments ZeroVecLike with methods allowing for mutation of the underlying
vector for owned vector types.
Methods are prefixed with zvl_* to avoid clashes with methods on the types themselves
Associated Types
type OwnedTypeThe type returned by
Self::remove()andSelf::replace()
Required Methods
fn zvl_insert(self: &mut Self, index: usize, value: &T)Insert an element at
indexfn zvl_remove(self: &mut Self, index: usize) -> <Self as >::OwnedTypeRemove the element at
index(panicking if nonexistant)fn zvl_replace(self: &mut Self, index: usize, value: &T) -> <Self as >::OwnedTypeReplace the element at
indexwith another one, returning the old elementfn zvl_push(self: &mut Self, value: &T)Push an element to the end of this vector
fn zvl_with_capacity(cap: usize) -> SelfCreate a new, empty vector, with given capacity
fn zvl_clear(self: &mut Self)Remove all elements from the vector
fn zvl_reserve(self: &mut Self, addl: usize)Reserve space for
addladditional elementsfn zvl_permute(self: &mut Self, permutation: &mut [usize])Applies the permutation such that
before.zvl_get(permutation[i]) == after.zvl_get(i).Panics
If
permutationis not a valid permutation of lengthzvl_len().fn owned_as_t(o: &<Self as >::OwnedType) -> &TConvert an owned value to a borrowed T
fn zvl_from_borrowed(b: &'a <Self as >::SliceVariant) -> SelfConstruct from the borrowed version of the type
These are useful to ensure serialization parity between borrowed and owned versions
fn zvl_as_borrowed_inner(self: &Self) -> Option<&'a <Self as >::SliceVariant>Extract the inner borrowed variant if possible. Returns
Noneif the data is owned.This function behaves like
&'_ self -> Self::SliceVariant<'a>, where'ais the lifetime of this object's borrowed data.This function is similar to matching the
Borrowedvariant ofZeroVecorVarZeroVec, returning the inner borrowed type.
Implementors
impl<'a, T, F> MutableZeroVecLike for VarZeroVec<'a, T, F>impl<'a, T> MutableZeroVecLike for ZeroVec<'a, T>