mod codec_dispatch;
mod compressed_search_path;
mod error;
mod exact_fallback_adapter;
pub use codec_dispatch::{build_adapter, decode, encode, select_codec, CodecDispatch};
pub use compressed_search_path::CompressedSearchPath;
pub use error::{CompressionError, DecompressError};
pub use exact_fallback_adapter::ExactFallbackAdapter;
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum CodecId {
TurboQuant,
FibQuant,
Polar,
Qjl,
Uncompressed,
}
impl CodecId {
pub fn requires_exact_fallback(self) -> bool {
matches!(self, Self::TurboQuant | Self::FibQuant)
}
}
impl std::fmt::Display for CodecId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::TurboQuant => write!(f, "turbo_quant"),
Self::FibQuant => write!(f, "fib_quant"),
Self::Polar => write!(f, "polar"),
Self::Qjl => write!(f, "qjl"),
Self::Uncompressed => write!(f, "uncompressed"),
}
}
}