pub struct AstConfigBuilder { /* private fields */ }Expand description
Builder for AST configuration
Implementations§
Source§impl AstConfigBuilder
impl AstConfigBuilder
pub fn new() -> Self
Sourcepub fn result_type(self, result_type: &str) -> Self
pub fn result_type(self, result_type: &str) -> Self
Set the return type of the parse() function
Sourcepub fn span_type(self, span_type: &str) -> Self
pub fn span_type(self, span_type: &str) -> Self
Set the external span type (disables internal Span generation)
Sourcepub fn string_type(self, string_type: &str) -> Self
pub fn string_type(self, string_type: &str) -> Self
Set the external string type (e.g., “JsString”)
Sourcepub fn error_type(self, error_type: &str) -> Self
pub fn error_type(self, error_type: &str) -> Self
Set the external error type (disables internal ParseError generation)
Sourcepub fn no_parse_result(self) -> Self
pub fn no_parse_result(self) -> Self
Disable ParseResult enum generation
Sourcepub fn apply_mappings(self) -> Self
pub fn apply_mappings(self) -> Self
Enable AST mapping application
Sourcepub fn string_dict(self, dict_type: &str) -> Self
pub fn string_dict(self, dict_type: &str) -> Self
Enable string dictionary integration for string interning
Sourcepub fn string_dict_method(self, method: &str) -> Self
pub fn string_dict_method(self, method: &str) -> Self
Set custom method name for string interning (default: “get_or_insert”)
Sourcepub fn helper(self, code: &str) -> Self
pub fn helper(self, code: &str) -> Self
Add helper code (functions, constants) to be included in the generated parser
Sourcepub fn result_variant(self, name: &str, rust_type: &str) -> Self
pub fn result_variant(self, name: &str, rust_type: &str) -> Self
Add a custom ParseResult variant for typed AST nodes
Sourcepub fn result_variant_with_span(
self,
name: &str,
rust_type: &str,
span_expr: &str,
) -> Self
pub fn result_variant_with_span( self, name: &str, rust_type: &str, span_expr: &str, ) -> Self
Add a custom ParseResult variant with custom span extraction
Trait Implementations§
Source§impl Debug for AstConfigBuilder
impl Debug for AstConfigBuilder
Source§impl Default for AstConfigBuilder
impl Default for AstConfigBuilder
Source§fn default() -> AstConfigBuilder
fn default() -> AstConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AstConfigBuilder
impl RefUnwindSafe for AstConfigBuilder
impl Send for AstConfigBuilder
impl Sync for AstConfigBuilder
impl Unpin for AstConfigBuilder
impl UnsafeUnpin for AstConfigBuilder
impl UnwindSafe for AstConfigBuilder
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