[][src]Struct tree_sitter::TreeCursor

pub struct TreeCursor<'a>(_, _);

A stateful object for walking a syntax Tree efficiently.

Methods

impl<'a> TreeCursor<'a>[src]

pub fn node(&self) -> Node<'a>[src]

Get the tree cursor's current Node.

pub fn field_id(&self) -> Option<u16>[src]

Get the numerical field id of this tree cursor's current node.

See also field_name.

pub fn field_name(&self) -> Option<&str>[src]

Get the field name of this tree cursor's current node.

pub fn goto_first_child(&mut self) -> bool[src]

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.

pub fn goto_parent(&mut self) -> bool[src]

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).

pub fn goto_next_sibling(&mut self) -> bool[src]

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.

pub fn goto_first_child_for_byte(&mut self, index: usize) -> Option<usize>[src]

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.

pub fn reset(&mut self, node: Node<'a>)[src]

Re-initialize this tree cursor to start at a different node.

Trait Implementations

impl<'a> Drop for TreeCursor<'a>[src]

Auto Trait Implementations

impl<'a> !Send for TreeCursor<'a>

impl<'a> !Sync for TreeCursor<'a>

impl<'a> Unpin for TreeCursor<'a>

impl<'a> UnwindSafe for TreeCursor<'a>

impl<'a> RefUnwindSafe for TreeCursor<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]