Skip to main content

ImportAdapter

Trait ImportAdapter 

Source
pub trait ImportAdapter: Send + Sync {
    // Required methods
    fn metadata(&self) -> &AdapterMetadata;
    fn configure(&mut self, config: AdapterConfig) -> Result<()>;
    fn import_instruction(&self, data: &[u8]) -> Result<GaiaInstruction>;
    fn import_program(&self, data: &[u8]) -> Result<GaiaModule>;
    fn validate_format(&self, data: &[u8]) -> bool;
    fn supported_extensions(&self) -> Vec<&str>;

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

Unified Import Adapter Interface

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

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 import_instruction(&self, data: &[u8]) -> Result<GaiaInstruction>

Import a single instruction

§Parameters
  • data - Platform-specific instruction data
§Return Value

Returns Gaia instruction on success, or an error message on failure.

Source

fn import_program(&self, data: &[u8]) -> Result<GaiaModule>

Import program

§Parameters
  • data - Platform-specific program data
§Return Value

Returns the converted Gaia program on success, or an error message on failure.

Source

fn validate_format(&self, data: &[u8]) -> bool

Validate data format

§Parameters
  • data - Data to validate
§Return Value

Returns true if the format is correct, false otherwise.

Source

fn supported_extensions(&self) -> Vec<&str>

Get supported file extensions

§Return Value

List of supported file extensions

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§