[][src]Struct deflate::CompressionOptions

pub struct CompressionOptions {
    pub max_hash_checks: u16,
    pub lazy_if_less_than: u16,
    pub matching_type: MatchingType,
    pub special: SpecialOptions,
}

A struct describing the options for a compressor or compression function.

These values are not stable and still subject to change!

Fields

max_hash_checks: u16

The maximum number of checks to make in the hash table for matches.

Higher numbers mean slower, but better compression. Very high (say >1024) values will impact compression speed a lot. The maximum match length is 2^15, so values higher than this won't make any difference, and will be truncated to 2^15 by the compression function/writer.

Default value: 128

lazy_if_less_than: u16

Only lazy match if we have a length less than this value.

Higher values degrade compression slightly, but improve compression speed.

As the maximum length of a match is 258, values higher than this will have no further effect.

matching_type: MatchingType

Whether to use lazy or greedy matching.

Lazy matching will provide better compression, at the expense of compression speed.

As a special case, if max_hash_checks is set to 0, and matching_type is set to lazy, compression using only run-length encoding (i.e maximum match distance of 1) is performed. (This may be changed in the future but is defined like this at the moment to avoid API breakage.

See MatchingType

special: SpecialOptions

Force fixed/stored blocks (Not implemented yet).

Methods

impl CompressionOptions[src]

pub fn high() -> CompressionOptions[src]

Returns compression settings rouhgly corresponding to the HIGH(9) setting in miniz.

pub fn fast() -> CompressionOptions[src]

Returns a fast set of compression settings

Ideally this should roughly correspond to the FAST(1) setting in miniz. However, that setting makes miniz use a somewhat different algorhithm, so currently hte fast level in this library is slower and better compressing than the corresponding level in miniz.

pub fn huffman_only() -> CompressionOptions[src]

Returns a set of compression settings that makes the compressor only compress using huffman coding. (Ignoring any length/distance matching)

This will normally have the worst compression ratio (besides only using uncompressed data), but may be the fastest method in some cases.

pub fn rle() -> CompressionOptions[src]

Returns a set of compression settings that makes the compressor compress only using run-length encoding (i.e only looking for matches one byte back).

This is very fast, but tends to compress worse than looking for more matches using hash chains that the slower settings do. Works best on data that has runs of equivialent bytes, like binary or simple images, less good for text.

Trait Implementations

impl Eq for CompressionOptions[src]

impl Default for CompressionOptions[src]

fn default() -> CompressionOptions[src]

Returns the options describing the default compression level.

impl Clone for CompressionOptions[src]

impl PartialEq<CompressionOptions> for CompressionOptions[src]

impl From<Compression> for CompressionOptions[src]

impl Copy for CompressionOptions[src]

impl Hash for CompressionOptions[src]

impl Debug for CompressionOptions[src]

Auto Trait Implementations

impl Send for CompressionOptions

impl Unpin for CompressionOptions

impl Sync for CompressionOptions

impl UnwindSafe for CompressionOptions

impl RefUnwindSafe for CompressionOptions

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]