Struct linked_syntax_tree::CursorMut
source · pub struct CursorMut<'a, T> { /* private fields */ }
Expand description
Roughly matches std::collections::linked_list::CursorMut
.
Implementations§
source§impl<T> CursorMut<'_, T>
impl<T> CursorMut<'_, T>
sourcepub fn current_mut(&mut self) -> Option<&mut T>
pub fn current_mut(&mut self) -> Option<&mut T>
Get the current element.
sourcepub fn insert_before(&mut self, item: T)
pub fn insert_before(&mut self, item: T)
Inserts an element before the current element.
If the cursor has None
current element it is set to the inserted element.
sourcepub fn insert_after(&mut self, item: T)
pub fn insert_after(&mut self, item: T)
Inserts an element after the current element.
If the cursor has None
current element it is set to the inserted element.
sourcepub fn remove_current(&mut self)
pub fn remove_current(&mut self)
Removes the current node.
When removing a node with a child node, this child node is removed.
sourcepub fn splice_after(&mut self, tree: SyntaxTree<T>)
pub fn splice_after(&mut self, tree: SyntaxTree<T>)
Inserts the elements from the given SyntaxTree
after the current one.
If the current element is None
it becomes the root element from the given SyntaxTree
.
sourcepub fn splice_before(&mut self, tree: SyntaxTree<T>)
pub fn splice_before(&mut self, tree: SyntaxTree<T>)
Inserts the elements from the given SyntaxTree
before the current one.
If the current element is None
it becomes the root element from the given SyntaxTree
.
sourcepub fn split_after(&mut self) -> SyntaxTree<T>
pub fn split_after(&mut self) -> SyntaxTree<T>
Splits the list into two after the current element. This will return a new list consisting of everything after the cursor, with the original list retaining everything before.
sourcepub fn split_before(&mut self) -> SyntaxTree<T>
pub fn split_before(&mut self) -> SyntaxTree<T>
Splits the list into two before the current element. This will return a new list consisting of everything before the cursor, with the original list retaining everything after.
Methods from Deref<Target = Cursor<'a, T>>§
sourcepub fn move_pred(&mut self)
pub fn move_pred(&mut self)
Moves the cursor to predecessor element.
If there is no previous value, the cursor is not moved.
sourcepub fn peek_child(&self) -> Option<&T>
pub fn peek_child(&self) -> Option<&T>
Returns a reference to the child element.