Skip to main content

ExportAdapter

Trait ExportAdapter 

Source
pub trait ExportAdapter: Send + Sync {
    // Required methods
    fn metadata(&self) -> &AdapterMetadata;
    fn configure(&mut self, config: AdapterConfig) -> Result<()>;
    fn export_instruction(
        &self,
        instruction: &GaiaInstruction,
    ) -> Result<Vec<u8>>;
    fn export_program(&self, program: &GaiaModule) -> Result<Vec<u8>>;
    fn supports_instruction(&self, instruction: &GaiaInstruction) -> bool;
    fn file_extension(&self) -> &str;

    // Provided method
    fn cleanup(&mut self) -> Result<()> { ... }
}
Expand description

Unified Export Adapter Interface

Defines a standard interface for exporting Gaia instructions and programs to platform-specific formats.

Required Methods§

Source

fn metadata(&self) -> &AdapterMetadata

Get adapter metadata

Source

fn configure(&mut self, config: AdapterConfig) -> Result<()>

Configure adapter

§Parameters
  • config - Adapter configuration
§Return Value

Returns Ok(()) on success, or an error message on failure.

Source

fn export_instruction(&self, instruction: &GaiaInstruction) -> Result<Vec<u8>>

Export a single instruction

§Parameters
  • instruction - Gaia instruction to export
§Return Value

Returns platform-specific instruction data on success, or an error message on failure.

Source

fn export_program(&self, program: &GaiaModule) -> Result<Vec<u8>>

Export the complete program

§Parameters
  • program - Gaia program to be exported
§Return Value

Returns platform-specific program data on success, or an error message on failure.

Source

fn supports_instruction(&self, instruction: &GaiaInstruction) -> bool

Verify if the instruction is supported

§Parameters
  • instruction - Instruction to verify
§Return Value

Returns true if supported, false otherwise.

Source

fn file_extension(&self) -> &str

Get the output file extension

§Return Value

Platform-specific file extension

Provided Methods§

Source

fn cleanup(&mut self) -> Result<()>

Clean up resources

Called when the adapter is no longer in use to clean up related resources

Implementors§