Enum Compression

#[non_exhaustive]
pub enum Compression

The type and strength of applied compression.

This is a simple, high-level interface that will automatically choose the appropriate DEFLATE compression mode and PNG filter.

If you need more control over the encoding parameters, you can set the DeflateCompression and Filter manually.

Variants

NoCompression

No compression whatsoever. Fastest, but results in large files.

Fastest

Extremely fast but light compression.

Note: When used in streaming mode, this compression level can actually result in files larger than would be produced by NoCompression on incompressible data because it doesn't do any buffering of the output stream to detect whether the data is being compressed or not.

Fast

Extremely fast compression with a decent compression ratio.

Significantly outperforms libpng and other popular encoders by using a specialized DEFLATE implementation tuned for PNG, while still providing better compression ratio than the fastest modes of other encoders.

Like Compression::Fastest this can currently produce files larger than NoCompression in streaming mode when given incompressible data. This may change in the future.

Balanced

Balances encoding speed and compression ratio

High

Spend much more time to produce a slightly smaller file than with Balanced.

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() -> Self

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) -> T

Returns the argument unchanged.

impl<T> ToOwned for Compression where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Compression where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses 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>