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>;

    // Provided method
    fn capabilities(&self) -> CodecCapabilityInfo { ... }
}
Expand description

INT-001: Object-safe vector codec boundary for derived vector artifacts.

This trait is the semantic-memory consumer-facing boundary. It should eventually be replaced by direct consumption of the canonical quant_codec_core::VectorCodec trait. Until then, implementations of this trait should also implement the canonical trait where practical.

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.

Provided Methods§

Source

fn capabilities(&self) -> CodecCapabilityInfo

INT-001: Codec capabilities — what operations this codec supports.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§