pub struct SyntaxTreeBuf<C> { /* private fields */ }
Expand description
SyntaxTreeBuf
owns the syntax tree allocation.
To construct a tree, see SyntaxBuilder
.
To access its contents, see SyntaxTree
’s methods.
Implementations§
Source§impl<C> SyntaxTreeBuf<C>
impl<C> SyntaxTreeBuf<C>
Sourcepub fn as_tree(&self) -> &SyntaxTree<C>
pub fn as_tree(&self) -> &SyntaxTree<C>
Returns a reference to the contained syntax tree data.
Methods from Deref<Target = SyntaxTree<C>>§
Sourcepub fn root(&self) -> SyntaxNode<C>
pub fn root(&self) -> SyntaxNode<C>
Returns the root node of this tree.
Sourcepub fn events(&self) -> impl Iterator<Item = Event<C>> + '_
pub fn events(&self) -> impl Iterator<Item = Event<C>> + '_
Returns an iterator over the events stored in this tree.
The difference between this method and SyntaxTree::raw_events
is that
this method returns SyntaxNode
s and SyntaxToken
s,
while SyntaxTree::raw_events
returns the data actually stored in the tree.
Sourcepub fn raw_events(&self) -> impl Iterator<Item = RawEvent<C>> + '_
pub fn raw_events(&self) -> impl Iterator<Item = RawEvent<C>> + '_
Returns an iterator over the raw events stored in this tree.
As compared to SyntaxTree::events
,
this method emits the data actually stored in the tree,
as opposed to handles to that data (SyntaxNode
s and SyntaxToken
s).
This method does not compute any more information
than what is stored in the tree.
The only difference between the RawEvent
s returned by this method
and what is stored inside the tree
is that the events returned by this method are fixed-length and typed,
while the tree’s internal storage is variable-length and untyped.