Skip to main content

VectorCodec

Trait VectorCodec 

Source
pub trait VectorCodec: Send + Sync {
    // Required methods
    fn profile(&self) -> &VectorCodecProfileV1;
    fn encode(&self, vector: &[f32]) -> Result<VectorArtifactV1, MemoryError>;
    fn decode(
        &self,
        artifact: &VectorArtifactV1,
    ) -> Result<Vec<f32>, MemoryError>;
}
Expand description

Object-safe vector codec boundary for derived vector artifacts.

Required Methods§

Source

fn profile(&self) -> &VectorCodecProfileV1

Codec profile identity.

Source

fn encode(&self, vector: &[f32]) -> Result<VectorArtifactV1, MemoryError>

Encode a raw f32 vector into a byte artifact.

Source

fn decode(&self, artifact: &VectorArtifactV1) -> Result<Vec<f32>, MemoryError>

Decode an artifact back to f32 for reference scoring or differential tests.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§