pub struct Inflate { /* private fields */ }Expand description
The state that is used to decompress an input.
Implementations§
Source§impl Inflate
impl Inflate
Sourcepub fn total_out(&self) -> u64
pub fn total_out(&self) -> u64
The amount of decompressed bytes that have been written to the output thus far.
Sourcepub fn error_message(&self) -> Option<&'static str>
pub fn error_message(&self) -> Option<&'static str>
The error message if the previous operation failed.
Sourcepub fn new(expect_header: bool, window_bits: u8) -> Self
pub fn new(expect_header: bool, window_bits: u8) -> Self
Create a new instance. This function allocates, and so it is recommended to re-use this
state when possible, using Inflate::reset as 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_bits can 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 = 8 is silently converted to
window_bits = 9 in most zlib implementations, and hence should be inflated using
window_bits = 9.
§Panics
This function may panic when the window_bits and expect_header have values not listed above.
Sourcepub fn decompress(
&mut self,
input: &[u8],
output: &mut [u8],
flush: InflateFlush,
) -> Result<Status, InflateError>
pub fn decompress( &mut self, input: &[u8], output: &mut [u8], flush: InflateFlush, ) -> Result<Status, InflateError>
Decompress input and write all decompressed bytes into output,
with flush defining some details about this.
Sourcepub fn decompress_uninit(
&mut self,
input: &[u8],
output: &mut [MaybeUninit<u8>],
flush: InflateFlush,
) -> Result<Status, InflateError>
pub fn decompress_uninit( &mut self, input: &[u8], output: &mut [MaybeUninit<u8>], flush: InflateFlush, ) -> Result<Status, InflateError>
Decompress input and write all decompressed bytes into a potentially uninitialized output,
with flush defining some details about this.