pub trait Compressor: Sized + Send + 'static where
    Self::CompressionLevel: Clone + Send + 'static,
    Self::Error: Error + Send + 'static, 
{ type Error; type CompressionLevel; const BLOCK_SIZE: usize; fn new(compression_level: Self::CompressionLevel) -> Self;
fn new_compression_level(
        compression_level: u8
    ) -> Result<Self::CompressionLevel, Self::Error>;
fn compress(
        &mut self,
        input: &[u8],
        output: &mut Vec<u8>,
        is_last: bool
    ) -> Result<(), Self::Error>; }
Expand description

A Compressor is used in the compressor pool to compress bytes.

An implementation must be provided as a type to the Pool::new function so that the pool knows what kind of compression to use.

See the module level example for more details.

Associated Types

Associated Constants

The BLOCK_SIZE is used to set the buffer size of the PooledWriters and should match the max size allowed by the block compression format being used.

Required methods

Create a new compressor with the given compression level.

Create an instance of the compression level.

The validity of the compression level should be checked here.

Compress a set of bytes into the output vec. If is_last is true, and depending on the block compression format, an EOF block may be appended as well.

Implementors