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
impl DeflateOptions
sourcepub const fn get_limit(&self) -> usize
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.
sourcepub const fn get_confirm_checksum(&self) -> bool
pub const fn get_confirm_checksum(&self) -> bool
Get whether the decoder will confirm a checksum after decoding
sourcepub fn set_confirm_checksum(self, yes: bool) -> Self
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
sourcepub const fn get_size_hint(&self) -> usize
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
sourcepub const fn set_size_hint(self, hint: usize) -> Self
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
impl Clone for DeflateOptions
source§fn clone(&self) -> DeflateOptions
fn clone(&self) -> DeflateOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Default for DeflateOptions
impl Default for DeflateOptions
impl Copy for DeflateOptions
Auto Trait Implementations§
impl Freeze for DeflateOptions
impl RefUnwindSafe for DeflateOptions
impl Send for DeflateOptions
impl Sync for DeflateOptions
impl Unpin for DeflateOptions
impl UnwindSafe for DeflateOptions
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)