pub trait Compression {
    // Required methods
    fn compress(
        &self,
        input: &[u8],
        output: &mut [u8]
    ) -> Result<usize, Lz4Error>;
    fn decompress(
        &self,
        input: &[u8],
        output: &mut [u8]
    ) -> Result<usize, Lz4Error>;
    fn get_maximum_compressed_buffer_len(
        &self,
        decompressed_len: usize
    ) -> usize;
}
Expand description

Used to provide implementation for the LZ4 compression/decompression methods

Required Methods§

source

fn compress(&self, input: &[u8], output: &mut [u8]) -> Result<usize, Lz4Error>

Compress the data.

§Arguments
§Result

The number of bytes written into the output

source

fn decompress(&self, input: &[u8], output: &mut [u8]) -> Result<usize, Lz4Error>

Decompress the data.

§Arguments
  • input data to compress
  • output buffer to write to. It must be allocated with the number of bytes specified in the header.
§Result

The number of bytes written into the output

source

fn get_maximum_compressed_buffer_len(&self, decompressed_len: usize) -> usize

Find the maximum size of the output buffer when compressing.

Implementors§