Struct Compression
pub struct Compression(/* private field */);
When compressing data, the compression level can be specified by a value in this enum.
Implementations
impl Compression
const fn new(level: u32) -> SelfCreate a new compression spec with a specific numeric level in the range
1..=9.Panics
A level outside of the
1..=9range will throw a panic. UseSelf::try_newto gracefully handle invalid levels (e.g. from user input).const fn try_new(level: u32) -> Option<Self>Create a new compression spec with a specific numeric level in the range
1..=9.fn none() -> SelfDo not compress.
const fn fast() -> SelfOptimize for the best speed of encoding.
const fn best() -> SelfOptimize for smallest output size.
const fn level(&self) -> u32Return the compression level as an integer.
Trait Implementations
impl Clone for Compression
fn clone(&self) -> Self
impl Copy for Compression
impl Debug for Compression
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Compression
fn default() -> SelfChoose the default compression, a balance between speed and size.
impl Eq for Compression
impl PartialEq for Compression
fn eq(&self, other: &Self) -> bool
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 UnsafeUnpin for Compression
impl UnwindSafe for Compression
Blanket Implementations
impl<T> Any for Compression
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Compression
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Compression
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Compression
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Compression
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Compression
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Compression
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 Compression
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Compression
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>