zexc 1.2.1

zex native lossless compressor — CLI zexc, library zexc, files *.zex
Documentation
//! ZEX compression backends — **one native algorithm**.
//!
//! Production codec: **[`zex_native`]** (original wire format + match finder).
//! Speed path: **[`turbo`]** (levels 1–2, same wire format).
//! Ratio helpers: **[`ldm`]** (long-distance matches), **[`optimal`]** (levels ≥ 15).
//!
//! There is **no** dependency on libzstd, liblz4, or any LZ4/Zstd crate.
//! Profiles (Turbo / Balanced / Max) only tune search cost — they never switch
//! to an external codec.

pub mod ldm;
pub mod optimal;
pub mod turbo;
pub mod zex_native;

use alloc::vec::Vec;

use crate::Result;
use crate::format::block::BlockType;

/// Trait implemented by block compressors.
pub trait BlockCompressor: Send + Sync {
    /// Compress `src` into `dst`. Returns block type used.
    fn compress_block(&self, src: &[u8], dst: &mut Vec<u8>, level: u8) -> Result<BlockType>;
}

/// Trait implemented by block decompressors.
pub trait BlockDecompressor: Send + Sync {
    /// Decompress `src` into `dst` for exactly `uncompressed_size` bytes.
    fn decompress_block(
        &self,
        src: &[u8],
        dst: &mut Vec<u8>,
        uncompressed_size: usize,
    ) -> Result<()>;
}