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§
fn modality(&self) -> Modality
fn ingest(&self, input: &[u8], config: &AdapterConfig) -> Result<CanonicalInput>
Sourcefn reconstruct(
&self,
input: &CanonicalInput,
config: &AdapterConfig,
) -> Result<Vec<u8>>
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.
Sourcefn capabilities(&self) -> AdapterCapabilities
fn capabilities(&self) -> AdapterCapabilities
Must state whether reconstruction is lossless.
Provided Methods§
Sourcefn spec(&self, config: &AdapterConfig) -> AdapterSpec
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".