pub trait Compressor:
Send
+ Sync
+ Clone
+ 'static {
// Required methods
fn name(&self) -> &str;
fn compress(&self, data: &[u8]) -> Result<Vec<u8>, CacheError>;
fn decompress(&self, data: &[u8]) -> Result<Vec<u8>, CacheError>;
// Provided method
fn should_compress(&self, data: &[u8]) -> bool { ... }
}Expand description
Trait for compression implementations
Required Methods§
Sourcefn decompress(&self, data: &[u8]) -> Result<Vec<u8>, CacheError>
fn decompress(&self, data: &[u8]) -> Result<Vec<u8>, CacheError>
Decompress data
Provided Methods§
Sourcefn should_compress(&self, data: &[u8]) -> bool
fn should_compress(&self, data: &[u8]) -> bool
Check if data should be compressed (based on size threshold)
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.