Trait Quantization

Source
pub trait Quantization:
    Send
    + Sync
    + Clone
    + Debug
    + DeepSizeOf
    + Into<Quantizer>
    + TryFrom<Quantizer, Error = Error> {
    type BuildParams: QuantizerBuildParams + Send + Sync;
    type Metadata: QuantizerMetadata + Send + Sync;
    type Storage: QuantizerStorage<Metadata = Self::Metadata> + VectorStore + Debug;

    // Required methods
    fn build(
        data: &dyn Array,
        distance_type: DistanceType,
        params: &Self::BuildParams,
    ) -> Result<Self>;
    fn code_dim(&self) -> usize;
    fn column(&self) -> &'static str;
    fn quantize(&self, vectors: &dyn Array) -> Result<ArrayRef>;
    fn metadata_key() -> &'static str;
    fn quantization_type() -> QuantizationType;
    fn metadata(&self, _: Option<QuantizationMetadata>) -> Result<Value>;
    fn from_metadata(
        metadata: &Self::Metadata,
        distance_type: DistanceType,
    ) -> Result<Quantizer>;

    // Provided method
    fn use_residual(_: DistanceType) -> bool { ... }
}

Required Associated Types§

Required Methods§

Source

fn build( data: &dyn Array, distance_type: DistanceType, params: &Self::BuildParams, ) -> Result<Self>

Source

fn code_dim(&self) -> usize

Source

fn column(&self) -> &'static str

Source

fn quantize(&self, vectors: &dyn Array) -> Result<ArrayRef>

Source

fn metadata_key() -> &'static str

Source

fn quantization_type() -> QuantizationType

Source

fn metadata(&self, _: Option<QuantizationMetadata>) -> Result<Value>

Source

fn from_metadata( metadata: &Self::Metadata, distance_type: DistanceType, ) -> Result<Quantizer>

Provided Methods§

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§