Struct tree_sitter::Tree[][src]

pub struct Tree(_);
Expand description

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]

fn clone(&self) -> Tree[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 Debug for Tree[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Drop for Tree[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

impl Send for Tree[src]

impl Sync for Tree[src]

Auto Trait Implementations

impl RefUnwindSafe for Tree

impl Unpin for Tree

impl UnwindSafe for Tree

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.