Struct flate2::Compression
source · pub struct Compression(/* private fields */);
Expand description
When compressing data, the compression level can be specified by a value in this struct.
Implementations§
source§impl Compression
impl Compression
sourcepub const fn new(level: u32) -> Compression
pub const fn new(level: u32) -> Compression
Creates a new description of the compression level with an explicitly specified integer.
The integer here is typically on a scale of 0-9 where 0 means “no compression” and 9 means “take as long as you’d like”.
§Backend differences
The miniz_oxide
backend for flate2
does not support level 0 or Compression::none()
. Instead it interprets them
as the default compression level, which is quite slow.
Compression::fast()
should be used instead.
miniz_oxide
also supports a non-compliant compression level 10.
It is even slower and may result in higher compression, but
only miniz_oxide will be able to read the data compressed with level 10.
Do not use level 10 if you need other software to be able to read it!
sourcepub const fn none() -> Compression
pub const fn none() -> Compression
No compression is to be performed, this may actually inflate data slightly when encoding.
sourcepub const fn fast() -> Compression
pub const fn fast() -> Compression
Optimize for the best speed of encoding.
sourcepub const fn best() -> Compression
pub const fn best() -> Compression
Optimize for the size of data being encoded.
Trait Implementations§
source§impl Clone for Compression
impl Clone for Compression
source§fn clone(&self) -> Compression
fn clone(&self) -> Compression
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Compression
impl Debug for Compression
source§impl Default for Compression
impl Default for Compression
source§fn default() -> Compression
fn default() -> Compression
source§impl PartialEq for Compression
impl PartialEq for Compression
source§fn eq(&self, other: &Compression) -> bool
fn eq(&self, other: &Compression) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for Compression
impl Eq for Compression
impl StructuralPartialEq for Compression
Auto Trait Implementations§
impl Freeze for Compression
impl RefUnwindSafe for Compression
impl Send for Compression
impl Sync for Compression
impl Unpin for Compression
impl UnwindSafe for Compression
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)