pub trait CodeGenerator {
// Required methods
fn target_name(&self) -> &'static str;
fn generate_all(
&self,
doc: &EtlDocument,
fault_tree_probs: &BTreeMap<String, f64>,
registry: &AsyncApiRegistry,
stem: &str,
diagnostics: &mut Vec<Diagnostic>,
) -> Result<Vec<GeneratedFile>, String>;
}Expand description
A pluggable code-generation backend (spec-neutral term: “target”). Every
target consumes the same validated EtlDocument + resolved fault-tree
probabilities + AsyncAPI registry — parsing, semantic validation, and
fault-tree evaluation happen exactly once, upstream of this trait, in
crate::Compiler; a target implementation only turns that already-
resolved representation into target-language source text. Nothing here
re-parses .etdl, re-validates ECEL conditions, or re-evaluates fault
trees — see docs/architecture/targets.md.
Required Methods§
Sourcefn target_name(&self) -> &'static str
fn target_name(&self) -> &'static str
Short, stable identifier used on the CLI (--target <name>) and in
the target registry (etdl-cli’s TargetRegistry). Lowercase,
matches the --target value exactly (e.g. "rust", "java").
Sourcefn generate_all(
&self,
doc: &EtlDocument,
fault_tree_probs: &BTreeMap<String, f64>,
registry: &AsyncApiRegistry,
stem: &str,
diagnostics: &mut Vec<Diagnostic>,
) -> Result<Vec<GeneratedFile>, String>
fn generate_all( &self, doc: &EtlDocument, fault_tree_probs: &BTreeMap<String, f64>, registry: &AsyncApiRegistry, stem: &str, diagnostics: &mut Vec<Diagnostic>, ) -> Result<Vec<GeneratedFile>, String>
Generate this target’s output for doc. stem is the input
document’s filename without extension (what today’s Rust target
already names its single output file after); other targets may use
it as a package/module root name instead of a literal filename.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".