[][src]Struct libdeflater::Compressor

pub struct Compressor { /* fields omitted */ }

A libdeflate compressor that can compress arbitrary data into DEFLATE, zlib, or gzip formats.

Implementations

impl Compressor[src]

pub fn new(lvl: CompressionLvl) -> Compressor[src]

Returns a newly constructed Compressor that compresses data with the supplied CompressionLvl

pub fn deflate_compress_bound(&mut self, n_bytes: usize) -> usize[src]

Returns the maximum number of bytes required to encode n_bytes as deflate data. This is a hard upper-bound that assumes the worst possible compression ratio (i.e. assumes the data cannot be compressed), format overhead, etc.

pub fn deflate_compress(
    &mut self,
    in_raw_data: &[u8],
    out_deflate_data: &mut [u8]
) -> Result<usize, CompressionError>
[src]

Compresses in_raw_data as deflate data, writing the data into out_deflate_data. Returns the number of bytes written into out_deflate_data.

pub fn zlib_compress_bound(&mut self, n_bytes: usize) -> usize[src]

Returns the maximum number of bytes required to encode n_bytes as zlib data. This is a hard upper-bound that assumes the worst possible compression ratio (i.e. assumes the data cannot be compressed), format overhead, etc.

pub fn zlib_compress(
    &mut self,
    in_raw_data: &[u8],
    out_zlib_data: &mut [u8]
) -> Result<usize, CompressionError>
[src]

Compresses in_raw_data as zlib data, writing the data into out_zlib_data. Returns the number of bytes written into out_zlib_data.

pub fn gzip_compress_bound(&mut self, n_bytes: usize) -> usize[src]

Returns the maximum number of bytes required to encode n_bytes as gzip data. This is a hard upper-bound that assumes the worst possible compression ratio (i.e. assumes the data cannot be compressed), format overhead, etc.

pub fn gzip_compress(
    &mut self,
    in_raw_data: &[u8],
    out_gzip_data: &mut [u8]
) -> Result<usize, CompressionError>
[src]

Compresses in_raw_data as gzip data, writing the data into out_gzip_data. Returns the number of bytes written into out_gzip_data.

Trait Implementations

impl Drop for Compressor[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.