Skip to main content

Decompressor

Trait Decompressor 

Source
pub trait Decompressor: Send {
    // Required methods
    fn format(&self) -> CompressionFormat;
    fn decompress(
        &mut self,
        input: &[u8],
        out: &mut Vec<u8>,
    ) -> Result<(), DecompressError>;
    fn finish(&mut self, out: &mut Vec<u8>) -> Result<(), DecompressError>;
}
Expand description

Streaming decompressor. Feed it arbitrary compressed bytes; decoded output is appended to the provided buffer.

Required Methods§

Source

fn format(&self) -> CompressionFormat

The format this decompressor consumes.

Source

fn decompress( &mut self, input: &[u8], out: &mut Vec<u8>, ) -> Result<(), DecompressError>

Decompress input, appending decoded bytes to out.

Input may split frames arbitrarily. out should be drained by the caller after each call to keep memory bounded.

Source

fn finish(&mut self, out: &mut Vec<u8>) -> Result<(), DecompressError>

Signal the end of the stream.

Flushes any complete trailing frames and verifies the stream is well-formed (no truncated frames). Call exactly once.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§