pub struct TreeSink<'a, L: Language> { /* private fields */ }Expand description
Collects the results of the parsing process.
Implementations§
Source§impl<'a, L: Language> TreeSink<'a, L>
impl<'a, L: Language> TreeSink<'a, L>
Sourcepub fn new(arena: &'a SyntaxArena, capacity_hint: usize) -> Self
pub fn new(arena: &'a SyntaxArena, capacity_hint: usize) -> Self
Creates a new tree sink.
Sourcepub fn push_leaf(&mut self, kind: L::TokenType, len: usize)
pub fn push_leaf(&mut self, kind: L::TokenType, len: usize)
Pushes a leaf node (token) to the current list of children.
Sourcepub fn push_node(&mut self, node: &'a GreenNode<'a, L>)
pub fn push_node(&mut self, node: &'a GreenNode<'a, L>)
Pushes an existing node to the current list of children.
Sourcepub fn checkpoint(&self) -> usize
pub fn checkpoint(&self) -> usize
Returns the current number of children, serving as a checkpoint for finishing a node later.
Sourcepub fn finish_node(
&mut self,
checkpoint: usize,
kind: L::ElementType,
) -> &'a GreenNode<'a, L>
pub fn finish_node( &mut self, checkpoint: usize, kind: L::ElementType, ) -> &'a GreenNode<'a, L>
Finishes a node starting from the given checkpoint and adds it as a child.
Auto Trait Implementations§
impl<'a, L> Freeze for TreeSink<'a, L>
impl<'a, L> !RefUnwindSafe for TreeSink<'a, L>
impl<'a, L> Send for TreeSink<'a, L>
impl<'a, L> Sync for TreeSink<'a, L>
impl<'a, L> Unpin for TreeSink<'a, L>
impl<'a, L> !UnwindSafe for TreeSink<'a, L>
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