Struct linked_syntax_tree::Cursor
source · pub struct Cursor<'a, T> { /* private fields */ }
Expand description
Roughly matches std::collections::linked_list::Cursor
.
Implementations§
source§impl<T: Debug> Cursor<'_, T>
impl<T: Debug> Cursor<'_, 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 move_child(&mut self)
pub fn move_child(&mut self)
Moves the cursor to the child element.
sourcepub fn move_successor(&mut self) -> bool
pub fn move_successor(&mut self) -> bool
Moves the cursor to the successor element or the next element of the root element if a successor is not present.
Returns true
if the cursor was moved to a successor or false
if
not.
sourcepub fn move_parent(&mut self) -> bool
pub fn move_parent(&mut self) -> bool
Moves the cursor through predecessor elements until reaching a parent or the root element.
Returns true
if the cursor was moved to a parent or false
if it was moved to the root
element.
sourcepub fn peek_parent(&self) -> Option<&T>
pub fn peek_parent(&self) -> Option<&T>
Returns a reference to the parent element.
Wrapper around self.peek_predecessor().and_then(Predecessor::parent)
.
sourcepub fn peek_previous(&self) -> Option<&T>
pub fn peek_previous(&self) -> Option<&T>
Returns a reference to the previous element.
Wrapper around self.peek_predecessor().and_then(Predecessor::previous)
.
sourcepub fn peek_predecessor(&self) -> Option<Predecessor<&T>>
pub fn peek_predecessor(&self) -> Option<Predecessor<&T>>
Returns a reference to the predecessor element.
sourcepub fn peek_child(&self) -> Option<&T>
pub fn peek_child(&self) -> Option<&T>
Returns a reference to the child element.