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,

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

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

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

impl<T> From<T> for Compression

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

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

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

impl<T, U> TryInto<U> for Compression where U: TryFrom<T>,