pub trait Cursor {
type Node;
// Required methods
fn goto_first_child(&mut self) -> bool;
fn goto_parent(&mut self) -> bool;
fn goto_next_sibling(&mut self) -> bool;
fn node(&self) -> Self::Node;
}Expand description
Trait which represents a stateful cursor in a n-ary tree. The cursor can be moved between nodes in the tree by the given methods, and the node which the cursor is currently pointing at can be read as well.
Required Associated Types§
Required Methods§
Sourcefn goto_first_child(&mut self) -> bool
fn goto_first_child(&mut self) -> bool
Move this cursor to the first child of its current node.
This returns true if the cursor successfully moved, and returns false
if there were no children.
Sourcefn goto_parent(&mut self) -> bool
fn goto_parent(&mut self) -> bool
Move this cursor to the parent of its current node.
This returns true if the cursor successfully moved, and returns false
if there was no parent node (the cursor was already on the root node).
Sourcefn goto_next_sibling(&mut self) -> bool
fn goto_next_sibling(&mut self) -> bool
Move this cursor to the next sibling of its current node.
This returns true if the cursor successfully moved, and returns false
if there was no next sibling node.
Implementations on Foreign Types§
Source§impl<'a> Cursor for TreeCursor<'a>
Available on crate feature tree-sitter only.Quintessential implementation of Cursor for tree-sitter’s TreeCursor
impl<'a> Cursor for TreeCursor<'a>
tree-sitter only.Quintessential implementation of Cursor for tree-sitter’s TreeCursor