pub struct DeflateOptions { /* private fields */ }
Expand description

Options that can influence decompression in Deflate/Zlib/Gzip

To use them, pass a customized options to the deflate decoder.

Implementations§

source§

impl DeflateOptions

source

pub const fn get_limit(&self) -> usize

Get deflate/zlib limit option

The decoder won’t extend the inbuilt limit and will return an error if the limit is exceeded

Returns

The currently set limit of the instance

Note

This is provided as a best effort, correctly quiting is detrimental to speed and hence this should not be relied too much.

source

pub fn set_limit(self, limit: usize) -> Self

Set a limit to the internal vector used to store decoded zlib/deflate output.

Arguments

limit: The new decompressor limit

Returns

A modified version of DeflateDecoder

Note

This is provided as a best effort, correctly quiting is detrimental to speed and hence this should not be relied too much

source

pub const fn get_confirm_checksum(&self) -> bool

Get whether the decoder will confirm a checksum after decoding

source

pub fn set_confirm_checksum(self, yes: bool) -> Self

Set whether the decoder should confirm a checksum after decoding

Note, you should definitely confirm your checksum, use this with caution, otherwise data returned may be corrupt

Arguments
  • yes: When true, the decoder will confirm checksum when false, the decoder will skip checksum verification
Notes

This does not have an influence for deflate decoding as it does not have a checksum

source

pub const fn get_size_hint(&self) -> usize

Get the default set size hint for the decompressor

The decompressor initializes the internal storage for decompressed bytes with this size and will reallocate the vec if the decompressed size becomes bigger than this, but when the user currently knows how big the output will be, can be used to prevent unnecessary re-allocations

source

pub const fn set_size_hint(self, hint: usize) -> Self

Set the size hint for the decompressor

This can be used to prevent multiple re-allocations

Trait Implementations§

source§

impl Clone for DeflateOptions

source§

fn clone(&self) -> DeflateOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for DeflateOptions

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Copy for DeflateOptions

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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.