Struct Inflate
pub struct Inflate { /* private fields */ }
The state that is used to decompress an input.
Implementations
impl Inflate
fn total_in(&self) -> u64The amount of bytes consumed from the input so far.
fn total_out(&self) -> u64The amount of decompressed bytes that have been written to the output thus far.
fn error_message(&self) -> Option<&'static str>The error message if the previous operation failed.
fn new(expect_header: bool, window_bits: u8) -> SelfCreate a new instance. This function allocates, and so it is recommended to re-use this state when possible, using
Inflate::resetas needed.This function will:
- decode a raw deflate stream when
expect_header = falseandwindow_bitsis in the range8..=15 - decode a zlib header followed by a deflate stream when
expect_header = trueandwindow_bitsis in the range8..=15 - decode a gzip header followed by a deflate stream when
expect_header = trueandwindow_bitsis in the range16 + 8..=16 + 15 - decode either a zlib or a gzip header, followed by a deflate stream when
expect_header = trueandwindow_bitsis in the range32 + 8..=32 + 15
window_bitscan also be 0 to request that inflate use the window size in the zlib header of the compressed stream when using zlib.Note that when deflating a value of
window_bits = 8is silently converted towindow_bits = 9in most zlib implementations, and hence should be inflated usingwindow_bits = 9.Panics
This function may panic when the
window_bitsandexpect_headerhave values not listed above.- decode a raw deflate stream when
fn reset(&mut self, zlib_header: bool)Reset the state to allow handling a new stream.
fn decompress(&mut self, input: &[u8], output: &mut [u8], flush: InflateFlush) -> Result<Status, InflateError>Decompress
inputand write all decompressed bytes intooutput, withflushdefining some details about this.fn decompress_uninit(&mut self, input: &[u8], output: &mut [MaybeUninit<u8>], flush: InflateFlush) -> Result<Status, InflateError>Decompress
inputand write all decompressed bytes into a potentially uninitializedoutput, withflushdefining some details about this.fn set_dictionary(&mut self, dictionary: &[u8]) -> Result<u32, InflateError>
Trait Implementations
impl Drop for Inflate
fn drop(&mut self)