Struct tree_sitter::TreeCursor[][src]

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

A stateful object for walking a syntax Tree efficiently.

Implementations

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<&'static 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> Clone for TreeCursor<'a>[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.