Struct Decoder

struct Decoder<'a, R> { ... }

A decoder that decompress input data from another Read.

This allows to read a stream of compressed data (good for files or heavy network stream).

Implementations

impl<'a, R: BufRead> Decoder<'a, R>

fn with_context(reader: R, context: &'a mut DCtx<'static>) -> Self

Creates a new decoder which employs the provided context for deserialization.

fn single_frame(self: Self) -> Self

Sets this Decoder to stop after the first frame.

By default, it keeps concatenating frames until EOF is reached.

fn with_prepared_dictionary<'b>(reader: R, dictionary: &DecoderDictionary<'b>) -> Result<Self>
where
    'b: 'a

Creates a new decoder, using an existing DecoderDictionary.

The dictionary must be the same as the one used during compression.

fn with_ref_prefix<'b>(reader: R, ref_prefix: &'b [u8]) -> Result<Self>
where
    'b: 'a

Creates a new decoder, using a ref prefix.

The prefix must be the same as the one used during compression.

fn recommended_output_size() -> usize

Recommendation for the size of the output buffer.

fn get_ref(self: &Self) -> &R

Acquire a reference to the underlying reader.

fn get_mut(self: &mut Self) -> &mut R

Acquire a mutable reference to the underlying reader.

Note that mutation of the reader may result in surprising results if this decoder is continued to be used.

fn finish(self: Self) -> R

Return the inner Read.

Calling finish() is not required after reading a stream - just use it if you need to get the Read back.

fn set_parameter(self: &mut Self, parameter: DParameter) -> Result<()>

Sets a decompression parameter on the decompression stream.

fn window_log_max(self: &mut Self, log_distance: u32) -> Result<()>

Sets the maximum back-reference distance.

The actual maximum distance is going to be 2^log_distance.

This will need to at least match the value set when compressing.

impl<R: BufRead> Decoder<'static, R>

fn with_buffer(reader: R) -> Result<Self>

Creates a new decoder around a BufRead.

fn with_dictionary(reader: R, dictionary: &[u8]) -> Result<Self>

Creates a new decoder, using an existing dictionary.

The dictionary must be the same as the one used during compression.

impl<R: Read> Decoder<'static, BufReader<R>>

fn new(reader: R) -> Result<Self>

Creates a new decoder.

impl<'a, R> Freeze for Decoder<'a, R>

impl<'a, R> RefUnwindSafe for Decoder<'a, R>

impl<'a, R> Send for Decoder<'a, R>

impl<'a, R> Sync for Decoder<'a, R>

impl<'a, R> Unpin for Decoder<'a, R>

impl<'a, R> UnsafeUnpin for Decoder<'a, R>

impl<'a, R> UnwindSafe for Decoder<'a, R>

impl<R: BufRead> Read for Decoder<'_, R>

fn read(self: &mut Self, buf: &mut [u8]) -> Result<usize>

impl<T> Any for Decoder<'a, R>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Decoder<'a, R>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Decoder<'a, R>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for Decoder<'a, R>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Decoder<'a, R>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Decoder<'a, R>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Decoder<'a, R>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>