pub trait Codec: Compressor + Decompressor {
// Required methods
fn new() -> Self
where Self: Sized;
fn with_level(level: CompressionLevel) -> Self
where Self: Sized;
// Provided methods
fn verify_roundtrip(&self, data: &[u8]) -> Result<bool> { ... }
fn measure_ratio(&self, data: &[u8]) -> Result<CompressionRatio> { ... }
}Expand description
Combined codec for both compression and decompression.
Required Methods§
Sourcefn with_level(level: CompressionLevel) -> Selfwhere
Self: Sized,
fn with_level(level: CompressionLevel) -> Selfwhere
Self: Sized,
Create a new codec with specified level.
Provided Methods§
Sourcefn verify_roundtrip(&self, data: &[u8]) -> Result<bool>
fn verify_roundtrip(&self, data: &[u8]) -> Result<bool>
Round-trip test: compress then decompress. Returns true if data matches.
Sourcefn measure_ratio(&self, data: &[u8]) -> Result<CompressionRatio>
fn measure_ratio(&self, data: &[u8]) -> Result<CompressionRatio>
Get compression ratio for given data.