#[repr(transparent)]pub struct Tree<Root: Node<'static>>(pub Tree, _);Tuple Fields§
§0: TreeImplementations§
Source§impl<Root: Node<'static>> Tree<Root>
impl<Root: Node<'static>> Tree<Root>
Sourcepub fn wrap(tree: Tree) -> Self
pub fn wrap(tree: Tree) -> Self
Convert a tree-sitter tree into a typed tree by specifying the correct root node type.
This will succeed even if Root is not the language’s root node, because
root_node checks that the root node is the correct type.
Sourcepub fn root_node(&self) -> NodeResult<'_, Root::WithLifetime<'_>>
pub fn root_node(&self) -> NodeResult<'_, Root::WithLifetime<'_>>
Get the root node of this tree.
Returns Err if the root is the wrong type, which may happen even if the language is
correct if the entire tree is an error node.
Sourcepub fn walk(&self) -> TreeCursor<'_>
pub fn walk(&self) -> TreeCursor<'_>
Create a cursor starting at the root node
Sourcepub fn included_ranges(&self) -> Vec<Range>
pub fn included_ranges(&self) -> Vec<Range>
Get the included ranges used to parse the tree
Sourcepub fn changed_ranges(
&self,
other: &Tree<Root>,
) -> impl ExactSizeIterator<Item = Range>
pub fn changed_ranges( &self, other: &Tree<Root>, ) -> impl ExactSizeIterator<Item = Range>
Get the changed ranges. See tree_sitter::Tree::changed_ranges
Sourcepub fn language(&self) -> LanguageRef<'_>
pub fn language(&self) -> LanguageRef<'_>
Get the language used to parse the tree.
Sourcepub fn print_dot_graph(&self, file: &impl AsRawFd)
pub fn print_dot_graph(&self, file: &impl AsRawFd)
Print a dot graph of the tree to the given file. See tree_sitter::Tree::print_dot_graph
Sourcepub fn edit(&mut self, edit: &InputEdit)
pub fn edit(&mut self, edit: &InputEdit)
Edit the tree. See tree_sitter::Tree::edit
Trait Implementations§
Auto Trait Implementations§
impl<Root> Freeze for Tree<Root>
impl<Root> RefUnwindSafe for Tree<Root>where
Root: RefUnwindSafe,
impl<Root> Send for Tree<Root>where
Root: Send,
impl<Root> Sync for Tree<Root>where
Root: Sync,
impl<Root> Unpin for Tree<Root>where
Root: Unpin,
impl<Root> UnwindSafe for Tree<Root>where
Root: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more