pub struct TreeCursor<'a>(/* private fields */);
Expand description
A stateful object for walking a syntax Tree
efficiently.
Implementations§
Source§impl<'a> TreeCursor<'a>
impl<'a> TreeCursor<'a>
Sourcepub unsafe fn from_raw(ptr: *mut TSTreeCursor) -> TreeCursor<'a>
pub unsafe fn from_raw(ptr: *mut TSTreeCursor) -> TreeCursor<'a>
Sourcepub fn into_raw(self) -> *mut TSTreeCursor
pub fn into_raw(self) -> *mut TSTreeCursor
Consumes the TreeCursor, returning a raw pointer to the underlying C structure.
Source§impl<'a> TreeCursor<'a>
impl<'a> TreeCursor<'a>
Sourcepub fn field_id(&self) -> Option<u16>
pub fn field_id(&self) -> Option<u16>
Get the numerical field id of this tree cursor’s current node.
See also field_name.
Sourcepub fn field_name(&self) -> Option<&'static str>
pub fn field_name(&self) -> Option<&'static str>
Get the field name of this tree cursor’s current node.
Sourcepub fn goto_first_child(&mut self) -> bool
pub 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.
Sourcepub fn goto_parent(&mut self) -> bool
pub 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).
Sourcepub fn goto_next_sibling(&mut self) -> bool
pub 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.
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 this cursor to the first child of its current node that extends beyond the given byte offset.
This returns the index of the child node if one was found, and returns None
if no such child was found.
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 this cursor to the first child of its current node that extends beyond the given byte offset.
This returns the index of the child node if one was found, and returns None
if no such child was found.