Skip to main content

CodegenBackend

Trait CodegenBackend 

Source
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§

Source

fn lang(&self) -> &str

Language identifier. Examples: "rust", "cpp", "ida", "binja".

Source

fn generate( &self, ir: &ValidatedDef, config: &GenTarget, ) -> Result<String, CodegenError>

Generate source code from the decoder IR and configuration.

Source

fn formatter_command(&self) -> Option<&[&str]>

Command to format the generated source. None skips formatting.

Implementors§