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>
impl<'a> Inflater<'a>
pub fn new(window: &'a mut [u8; 32768], limits: InflateLimits) -> Inflater<'a>
Sourcepub fn new_raw(
window: &'a mut [u8; 32768],
limits: InflateLimits,
) -> Inflater<'a>
pub fn new_raw( window: &'a mut [u8; 32768], limits: InflateLimits, ) -> Inflater<'a>
Decode a raw RFC 1951 stream. The host must validate its outer envelope
and checksum before exposing output. reset starts a zlib stream again.
Sourcepub fn reset(&mut self, limits: InflateLimits)
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.
pub fn total_input(&self) -> u64
pub fn total_output(&self) -> u64
Sourcepub fn update(
&mut self,
input: &[u8],
output: &mut [u8],
end_of_input: bool,
) -> Result<InflateProgress, Error>
pub fn update( &mut self, input: &[u8], output: &mut [u8], end_of_input: bool, ) -> Result<InflateProgress, Error>
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.