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)
Auto Trait Implementations
impl !UnwindSafe for Inflate
impl Freeze for Inflate
impl RefUnwindSafe for Inflate
impl Send for Inflate
impl Sync for Inflate
impl Unpin for Inflate
impl UnsafeUnpin for Inflate
Blanket Implementations
impl<T> Any for Inflate
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Inflate
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Inflate
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Inflate
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Inflate
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Inflate
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Inflate
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>