Skip to main content

QuantizationCodec

Trait QuantizationCodec 

Source
pub trait QuantizationCodec: Sized {
    // Required methods
    fn to_bytes(&self) -> Vec<u8> ;
    fn from_bytes(bytes: &[u8]) -> Result<Self>;
}
Expand description

Trait for serializing and deserializing quantized vectors to/from bytes.

Provides a uniform interface for byte-level serialization across different quantization strategies (SQ8, Binary).

Required Methods§

Source

fn to_bytes(&self) -> Vec<u8>

Serializes the quantized vector to a byte representation.

Source

fn from_bytes(bytes: &[u8]) -> Result<Self>

Deserializes a quantized vector from bytes.

§Errors

Returns an error if the byte slice is too short or contains invalid data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§