zune_inflate

Struct DeflateOptions

source
pub struct DeflateOptions {
    limit: usize,
    confirm_checksum: bool,
    size_hint: usize,
}
Expand description

Options that can influence decompression in Deflate/Zlib/Gzip

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

Fields§

§limit: usize§confirm_checksum: bool§size_hint: usize

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 T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.