Struct linked_vector::CursorMut
source · pub struct CursorMut<'a, T> { /* private fields */ }
Expand description
A cursor which can read and write the elements of the list.
Implementations§
source§impl<'a, T> CursorMut<'a, T>
impl<'a, T> CursorMut<'a, T>
sourcepub fn get_mut(&mut self) -> Option<&mut T>
pub fn get_mut(&mut self) -> Option<&mut T>
Returns a mutable reference to the element at the cursor’s current position.
sourcepub fn insert(&mut self, value: T) -> HNode
pub fn insert(&mut self, value: T) -> HNode
Inserts a new element at the cursor’s current position. The cursor will be moved to the new element. Returns the handle of the new element.
sourcepub fn insert_after(&mut self, value: T) -> HNode
pub fn insert_after(&mut self, value: T) -> HNode
Inserts a new element after the cursor’s current position. The cursor will still be at the same position. Returns the handle of the new element.
sourcepub fn remove(&mut self) -> Option<T>
pub fn remove(&mut self) -> Option<T>
Removes the element at the current position and returns its value. The
cursor will be moved to the next element if not at the end of the
vector, otherwise it moves to the new end. If there was only one item
in the vector, the cursor’s position is set to BAD_HANDLE
and should
no longer be used, or could cause invalid handle panics.