use crate::protocol::buf::{ByteBuf, ByteBufMut};
use anyhow::Result;
#[cfg(feature = "gzip")]
mod gzip;
#[cfg(feature = "lz4")]
mod lz4;
mod none;
#[cfg(feature = "snappy")]
mod snappy;
#[cfg(feature = "zstd")]
mod zstd;
#[cfg(feature = "gzip")]
pub use gzip::Gzip;
#[cfg(feature = "lz4")]
pub use lz4::Lz4;
pub use none::None;
#[cfg(feature = "snappy")]
pub use snappy::Snappy;
#[cfg(feature = "zstd")]
pub use zstd::Zstd;
pub trait Compressor<B: ByteBufMut> {
type BufMut: ByteBufMut;
fn compress<R, F>(buf: &mut B, f: F) -> Result<R>
where
F: FnOnce(&mut Self::BufMut) -> Result<R>;
}
pub trait Decompressor<B: ByteBuf> {
type Buf: ByteBuf;
fn decompress<R, F>(buf: &mut B, f: F) -> Result<R>
where
F: FnOnce(&mut Self::Buf) -> Result<R>;
}