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§
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".