pub struct StackInsert<'a, T> { /* private fields */ }
Methods from Deref<Target = LowMap<T>>§
Sourcepub fn insert(&mut self, index: usize, value: T) -> Option<T>
pub fn insert(&mut self, index: usize, value: T) -> Option<T>
Inserts an element at position index
within the vector, returning the
previous value if present.
Sourcepub fn stack_insert(&mut self, index: usize, value: T) -> StackInsert<'_, T>
pub fn stack_insert(&mut self, index: usize, value: T) -> StackInsert<'_, T>
Constructs a wrapper that temporarily inserts an element.
The returned wrapper will undo the insert when dropped.
Sourcepub fn remove(&mut self, index: usize) -> Option<T>
pub fn remove(&mut self, index: usize) -> Option<T>
Removes and returns the element at position index
if present.
Sourcepub fn get(&self, index: usize) -> Option<&T>
pub fn get(&self, index: usize) -> Option<&T>
Returns a reference to the element at position index
if present.
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 element at position index
if
present.
Sourcepub fn contains(&self, index: usize) -> bool
pub fn contains(&self, index: usize) -> bool
Tests whether an element is present at position index
or not.
Sourcepub fn push(&mut self, elem: T) -> usize
pub fn push(&mut self, elem: T) -> usize
Finds the first free index to store the given elem
.
Has a maxium complexity of O(n).
Sourcepub fn values_mut(&mut self) -> ValuesMut<'_, T> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_, T> ⓘ
Returns a mutable iterator over the value of stored elements.
Sourcepub fn iter(&self) -> Iter<'_, T> ⓘ
pub fn iter(&self) -> Iter<'_, T> ⓘ
Returns an iterator over the index and value of stored elements.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
Returns a mutable iterator over the index and value of stored elements.
Trait Implementations§
Source§impl<'a, T> Deref for StackInsert<'a, T>
impl<'a, T> Deref for StackInsert<'a, T>
Source§impl<'a, T> DerefMut for StackInsert<'a, T>
impl<'a, T> DerefMut for StackInsert<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for StackInsert<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for StackInsert<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for StackInsert<'a, T>where
T: Send,
impl<'a, T> Sync for StackInsert<'a, T>where
T: Sync,
impl<'a, T> Unpin for StackInsert<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for StackInsert<'a, T>
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