Skip to main content

Inflater

Struct Inflater 

Source
pub struct Inflater<'a> { /* private fields */ }
Expand description

Incremental zlib decoder with no allocation or dependency on std/alloc.

The caller owns a 32 KiB history window, this state (less than 2 KiB), and arbitrarily sized input/output chunks. Stored, fixed and dynamic Huffman blocks are supported. Preset dictionaries return Error::Unsupported. Output is provisional until InflateStatus::Finished; discard it on error. Inflation does not validate Git object headers, lengths or IDs.

Implementations§

Source§

impl<'a> Inflater<'a>

Source

pub fn new(window: &'a mut [u8; 32768], limits: InflateLimits) -> Self

Source

pub fn new_raw(window: &'a mut [u8; 32768], limits: InflateLimits) -> Self

Decode a raw RFC 1951 stream. The host must validate its outer envelope and checksum before exposing output. reset starts a zlib stream again.

Source

pub fn reset(&mut self, limits: InflateLimits)

Start an independent stream. Old history is inaccessible: each distance must refer to bytes emitted by the new stream before it can be read.

Source

pub fn total_input(&self) -> u64

Source

pub fn total_output(&self) -> u64

Source

pub fn update( &mut self, input: &[u8], output: &mut [u8], end_of_input: bool, ) -> Result<InflateProgress>

Consume only one stream, leaving subsequent pack entries/trailing bytes untouched. Empty chunks are accepted. end_of_input means this slice contains the last available bytes: a need for further input is truncation, while a need for more output remains resumable with the unconsumed suffix.

Errors are terminal until reset; output from the failing call may have been modified and must be discarded. Limits are checked before emitting each byte and do not depend on input/output chunk boundaries.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for Inflater<'a>

§

impl<'a> Freeze for Inflater<'a>

§

impl<'a> RefUnwindSafe for Inflater<'a>

§

impl<'a> Send for Inflater<'a>

§

impl<'a> Sync for Inflater<'a>

§

impl<'a> Unpin for Inflater<'a>

§

impl<'a> UnsafeUnpin for Inflater<'a>

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> Same for T

Source§

type Output = T

Should always be Self
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.