#[repr(transparent)]pub struct TreeCursor<'tree>(pub TreeCursor<'tree>);Expand description
A stateful object for walking a syntax tree efficiently. See raw::TreeCursor
Tuple Fields§
§0: TreeCursor<'tree>Implementations§
Source§impl<'tree> TreeCursor<'tree>
impl<'tree> TreeCursor<'tree>
Sourcepub fn wrap_ref<'a>(cursor: &'a TreeCursor<'_>) -> &'a Self
pub fn wrap_ref<'a>(cursor: &'a TreeCursor<'_>) -> &'a Self
Transmute an immutable reference, since they have the same representation.
Sourcepub fn wrap_mut<'a>(cursor: &'a mut TreeCursor<'_>) -> &'a mut Self
pub fn wrap_mut<'a>(cursor: &'a mut TreeCursor<'_>) -> &'a mut Self
Transmute a mutable reference, since they have the same representation.
Sourcepub fn node(&self) -> UntypedNode<'tree>
pub fn node(&self) -> UntypedNode<'tree>
Gets the cursor’s current node
Sourcepub fn field_name(&mut self) -> Option<&'static str>
pub fn field_name(&mut self) -> Option<&'static str>
Gets the field name of the cursor’s current node
Sourcepub fn reset(&mut self, node: impl Node<'tree>)
pub fn reset(&mut self, node: impl Node<'tree>)
Re-initialize the cursor to point to the given node
Sourcepub fn goto_first_child(&mut self) -> bool
pub fn goto_first_child(&mut self) -> bool
Move the cursor to the first child of the current node and return true, or return false
if the current node has no children
Sourcepub fn goto_first_child_for_byte(&mut self, index: usize) -> Option<usize>
pub fn goto_first_child_for_byte(&mut self, index: usize) -> Option<usize>
Move the cursor to the first child of the current node that extends beyond the given byte offset, and return its index.
Returns None if the current node has no children past that offset.
Sourcepub fn goto_first_child_for_point(&mut self, point: Point) -> Option<usize>
pub fn goto_first_child_for_point(&mut self, point: Point) -> Option<usize>
Move the cursor to the first child of the current node that extends beyond the given row and column, and return its index.
Returns None if the current node has no children past that row and column.
Sourcepub fn goto_next_sibling(&mut self) -> bool
pub fn goto_next_sibling(&mut self) -> bool
Move the cursor to the next sibling of the current node and return true, or return false
if the current node has no next sibling.
Also returns false if the cursor was initialized or re-initialized to this node, even if
it has a sibling.
Sourcepub fn goto_parent(&mut self) -> bool
pub fn goto_parent(&mut self) -> bool
Move the cursor to the parent of the current node and return true, or return false
if the current node is a tree root.
Also returns false if the cursor was initialized or re-initialized to this node, even if
it has a parent.
Trait Implementations§
Source§impl<'tree> Clone for TreeCursor<'tree>
impl<'tree> Clone for TreeCursor<'tree>
Source§fn clone(&self) -> TreeCursor<'tree>
fn clone(&self) -> TreeCursor<'tree>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more