Skip to main content

DslBuild

Trait DslBuild 

Source
pub trait DslBuild: Sized {
    // Required method
    fn from_parse_tree(
        tree: &ParseTree,
        ids: &IdGen,
    ) -> Result<Self, BuildError>;
}
Expand description

Contract for building a typed AST value from a validated ParseTree.

Implemented via #[derive(DslBuild)] in dsl-kit-macros (G-1c); hand-written impls are fine for shapes the derive cannot express (mixed tuple variants, generics, cross-type recursion, etc.).

Required Methods§

Source

fn from_parse_tree(tree: &ParseTree, ids: &IdGen) -> Result<Self, BuildError>

Builds a typed value from tree, minting fresh NodeIds from ids.

Implementations should call check_conformance against Self::schema() before dispatching per-variant so that shape mismatches surface as diagnostics rather than panics or ad-hoc errors. RawValue::Text payloads convert through FromStr; RawValue::Json payloads convert through serde_json::from_value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§