Skip to main content

ZlibStream

Struct ZlibStream 

Source
pub(super) struct ZlibStream {
    state: Box<Decompressor>,
    started: bool,
    ignore_adler32: bool,
}
Expand description

Ergonomics wrapper around miniz_oxide::inflate::stream for zlib compressed data.

Fields§

§state: Box<Decompressor>

Current decoding state.

§started: bool

If there has been a call to decompress already.

§ignore_adler32: bool

Ignore and do not calculate the Adler-32 checksum. Defaults to true.

This flag overrides TINFL_FLAG_COMPUTE_ADLER32.

This flag should not be modified after decompression has started.

Implementations§

Source§

impl ZlibStream

Source

pub(crate) fn new() -> Self

Source

pub(crate) fn reset(&mut self)

Source

pub(crate) fn set_ignore_adler32(&mut self, flag: bool) -> bool

Set the ignore_adler32 flag and return true if the flag was successfully set.

The default is true.

This flag cannot be modified after decompression has started until the ZlibStream is reset.

Source

pub(crate) fn ignore_adler32(&self) -> bool

Return the ignore_adler32 flag.

Source

pub(crate) fn decompress( &mut self, data: &[u8], image_data: &mut UnfilterBuf<'_>, ) -> Result<usize, DecodingError>

Fill the decoded buffer as far as possible from data. On success returns the number of consumed input bytes.

Source

pub(crate) fn finish( &mut self, image_data: &mut UnfilterBuf<'_>, ) -> Result<bool, DecodingError>

Output any remaining buffered data within the decompressor.

Returns Ok(true) if all data has been decompressed and there is no more data that will be produced, or Ok(false) if there’s potentially more output.

Returns Err if the zlib stream is corrupt or truncated too early.

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 = Infallible

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

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

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.