Skip to main content

ZlibStream

Struct ZlibStream 

Source
pub struct ZlibStream { /* private fields */ }
Expand description

An incremental zlib (RFC 1950) decompressor.

Wraps Inflater with the two-byte header, the running Adler-32 and the four-byte trailer. The checksum is computed as output is produced, so verifying it costs nothing extra and does not require retaining the output.

Implementations§

Source§

impl ZlibStream

Source

pub fn new(limit: usize) -> Self

A decompressor that will produce at most limit bytes.

Source

pub fn push(&mut self, data: &[u8]) -> Result<Vec<u8>>

Supply more compressed bytes and return whatever they decoded to.

§Errors

Returns Error for a bad header, an unsupported compression method, or any DEFLATE error.

Source

pub fn finish(&mut self) -> Result<Vec<u8>>

Declare the input over and verify the checksum.

§Errors

Returns Error if the stream ended mid-symbol, if the trailer is missing, or if the Adler-32 does not match.

Trait Implementations§

Source§

impl Debug for ZlibStream

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.