Struct tree_sitter::Tree[][src]

pub struct Tree(_);

A tree that represents the syntactic structure of a source code file.

Implementations

impl Tree[src]

pub fn root_node(&self) -> Node<'_>[src]

Get the root node of the syntax tree.

pub fn language(&self) -> Language[src]

Get the language that was used to parse the syntax tree.

pub fn edit(&mut self, edit: &InputEdit)[src]

Edit the syntax tree to keep it in sync with source code that has been edited.

You must describe the edit both in terms of byte offsets and in terms of row/column coordinates.

pub fn walk(&self) -> TreeCursor<'_>[src]

Create a new TreeCursor starting from the root of the tree.

pub fn changed_ranges(
    &self,
    other: &Tree
) -> impl ExactSizeIterator<Item = Range>
[src]

Compare this old edited syntax tree to a new syntax tree representing the same document, returning a sequence of ranges whose syntactic structure has changed.

For this to work correctly, this syntax tree must have been edited such that its ranges match up to the new tree. Generally, you’ll want to call this method right after calling one of the Parser::parse functions. Call it on the old tree that was passed to parse, and pass the new tree that was returned from parse.

Trait Implementations

impl Clone for Tree[src]

impl Debug for Tree[src]

impl Drop for Tree[src]

impl Send for Tree[src]

Auto Trait Implementations

impl RefUnwindSafe for Tree

impl !Sync for Tree

impl Unpin for Tree

impl UnwindSafe for Tree

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.