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§
Sourcefn profile(&self) -> &VectorCodecProfileV1
fn profile(&self) -> &VectorCodecProfileV1
Codec profile identity.
Sourcefn encode(&self, vector: &[f32]) -> Result<VectorArtifactV1, MemoryError>
fn encode(&self, vector: &[f32]) -> Result<VectorArtifactV1, MemoryError>
Encode a raw f32 vector into a byte artifact.
Sourcefn decode(&self, artifact: &VectorArtifactV1) -> Result<Vec<f32>, MemoryError>
fn decode(&self, artifact: &VectorArtifactV1) -> Result<Vec<f32>, MemoryError>
Decode an artifact back to f32 for reference scoring or differential tests.
Provided Methods§
Sourcefn capabilities(&self) -> CodecCapabilityInfo
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".