pub struct TreeBuilder { /* private fields */ }Implementations§
Source§impl TreeBuilder
impl TreeBuilder
pub fn new() -> TreeBuilder
Sourcepub fn with_capacity(elements: usize, text_len: usize) -> TreeBuilder
pub fn with_capacity(elements: usize, text_len: usize) -> TreeBuilder
Room for elements elements over text_len bytes of text, so the arrays never regrow.
pub fn start_node(&mut self, kind: SyntaxKind)
pub fn token(&mut self, kind: SyntaxKind, text: &str)
pub fn finish_node(&mut self)
pub fn is_empty(&self) -> bool
Sourcepub fn extract(&self, root: ElementId) -> Tree
pub fn extract(&self, root: ElementId) -> Tree
A standalone copy of the finished subtree rooted at root (a node pushed at the current
nesting level, with nothing pushed after its end).
Sourcepub fn push_tree(&mut self, tree: &Tree)
pub fn push_tree(&mut self, tree: &Tree)
Appends all of tree as the next child of the open node: Self::push_subtree of its
root, as block copies.
Sourcepub fn push_subtree(&mut self, tree: &Tree, e: ElementId)
pub fn push_subtree(&mut self, tree: &Tree, e: ElementId)
Appends a copy of e’s subtree from another tree.
pub fn finish(self) -> Tree
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TreeBuilder
impl RefUnwindSafe for TreeBuilder
impl Send for TreeBuilder
impl Sync for TreeBuilder
impl Unpin for TreeBuilder
impl UnsafeUnpin for TreeBuilder
impl UnwindSafe for TreeBuilder
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