pub struct CstBuilder { /* private fields */ }Expand description
A specialized builder for constructing CST nodes. This is a simpler alternative to CstCommands, designed specifically for tree construction.
Implementations§
Source§impl CstBuilder
impl CstBuilder
pub fn new() -> Self
Sourcepub fn terminal(
&mut self,
kind: TerminalKind,
data: impl Into<String>,
) -> BuilderNodeId
pub fn terminal( &mut self, kind: TerminalKind, data: impl Into<String>, ) -> BuilderNodeId
Insert a terminal and return its ID
Sourcepub fn non_terminal(
&mut self,
kind: NonTerminalKind,
children: Vec<impl Into<BuilderNodeId>>,
) -> BuilderNodeId
pub fn non_terminal( &mut self, kind: NonTerminalKind, children: Vec<impl Into<BuilderNodeId>>, ) -> BuilderNodeId
Insert a non-terminal with children and return its ID
Sourcepub fn embed(&mut self, builder: CstBuilder) -> BuilderNodeId
pub fn embed(&mut self, builder: CstBuilder) -> BuilderNodeId
Embed another builder and return its ID
Sourcepub fn apply<T, NT>(self, tree: &mut ConcreteSyntaxTree<T, NT>) -> CstNodeId
pub fn apply<T, NT>(self, tree: &mut ConcreteSyntaxTree<T, NT>) -> CstNodeId
Apply to tree and return the root node ID
Trait Implementations§
Source§impl Clone for CstBuilder
impl Clone for CstBuilder
Source§fn clone(&self) -> CstBuilder
fn clone(&self) -> CstBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CstBuilder
impl Debug for CstBuilder
Source§impl Default for CstBuilder
impl Default for CstBuilder
Source§fn default() -> CstBuilder
fn default() -> CstBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CstBuilder
impl RefUnwindSafe for CstBuilder
impl Send for CstBuilder
impl Sync for CstBuilder
impl Unpin for CstBuilder
impl UnwindSafe for CstBuilder
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