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_preceding(&mut self)
pub fn move_preceding(&mut self)
Moves the cursor to the preceding element.
If there is no preceding element 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_parent(&mut self) -> bool
pub fn move_parent(&mut self) -> bool
Moves the cursor through preceding 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 move_successor(&mut self) -> bool
pub fn move_successor(&mut self) -> bool
Moves the cursor to the successor element or the root element if a successor is not present.
Returns true
if the cursor was moved to a successor or false
if it was moved to the root
element.
sourcepub fn move_predecessor(&mut self) -> bool
pub fn move_predecessor(&mut self) -> bool
Moves the cursor to the predecessor element or the root element if a predecessor is not present.
Returns true
if the cursor was moved to a predecessor 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_preceding().and_then(Preceding::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_preceding().and_then(Preceding::previous)
.
sourcepub fn peek_preceding(&self) -> Option<Preceding<&T>>
pub fn peek_preceding(&self) -> Option<Preceding<&T>>
Returns a reference to the preceding element.
sourcepub fn peek_child(&self) -> Option<&T>
pub fn peek_child(&self) -> Option<&T>
Returns a reference to the child element.