pub trait CodegenBackend {
// Required methods
fn lang(&self) -> &str;
fn generate(
&self,
ir: &ValidatedDef,
config: &GenTarget,
) -> Result<String, CodegenError>;
fn formatter_command(&self) -> Option<&[&str]>;
}Expand description
Trait for language-specific code generation backends.
Required Methods§
Sourcefn generate(
&self,
ir: &ValidatedDef,
config: &GenTarget,
) -> Result<String, CodegenError>
fn generate( &self, ir: &ValidatedDef, config: &GenTarget, ) -> Result<String, CodegenError>
Generate source code from the decoder IR and configuration.
Sourcefn formatter_command(&self) -> Option<&[&str]>
fn formatter_command(&self) -> Option<&[&str]>
Command to format the generated source. None skips formatting.