Skip to main content

ModalityAdapter

Trait ModalityAdapter 

Source
pub trait ModalityAdapter: Send + Sync {
    // Required methods
    fn modality(&self) -> Modality;
    fn ingest(
        &self,
        input: &[u8],
        config: &AdapterConfig,
    ) -> Result<CanonicalInput>;
    fn reconstruct(
        &self,
        input: &CanonicalInput,
        config: &AdapterConfig,
    ) -> Result<Vec<u8>>;
    fn capabilities(&self) -> AdapterCapabilities;

    // Provided method
    fn spec(&self, config: &AdapterConfig) -> AdapterSpec { ... }
}
Expand description

Converts raw bytes of some format to canonical input and back (PRD 9.3).

Required Methods§

Source

fn modality(&self) -> Modality

Source

fn ingest(&self, input: &[u8], config: &AdapterConfig) -> Result<CanonicalInput>

Source

fn reconstruct( &self, input: &CanonicalInput, config: &AdapterConfig, ) -> Result<Vec<u8>>

config is the configuration the input was ingested with; a vocabulary stores it, so decoding uses the same field names and options.

Source

fn capabilities(&self) -> AdapterCapabilities

Must state whether reconstruction is lossless.

Provided Methods§

Source

fn spec(&self, config: &AdapterConfig) -> AdapterSpec

The specification stored in a vocabulary trained through this adapter.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§