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
NoCompressionon 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::Fastestthis can currently produce files larger thanNoCompressionin 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