#compress #gzip #deflate #bzip2 #no_std

no-std compression

Compression libraries implemented by pure Rust

6 releases

✓ Uses Rust 2018 edition

0.1.5 Nov 15, 2019
0.1.4 Jun 6, 2019
0.1.3 Dec 26, 2018
0.1.2 Jul 22, 2018
0.1.0 Mar 23, 2018

#26 in Compression

Download history 35/week @ 2019-10-13 69/week @ 2019-10-20 108/week @ 2019-10-27 32/week @ 2019-11-03 41/week @ 2019-11-10 50/week @ 2019-11-17 76/week @ 2019-11-24 14/week @ 2019-12-01 62/week @ 2019-12-08 59/week @ 2019-12-15 39/week @ 2019-12-22 51/week @ 2019-12-29 132/week @ 2020-01-05 256/week @ 2020-01-12 130/week @ 2020-01-19

245 downloads per month
Used in cemu-smm

MPL-2.0 license

1MB
9K SLoC

compression

crates.io badge Build Status docs.rs Coverage Status

Compression libraries implemented by pure Rust.

[dependencies]
compression = "0.1"

Features

  • deflate - Enabled by default.

  • gzip - Enabled by default.

  • zlib - Enabled by default.

  • bzip2 - Enabled by default.

  • lzhuf - Disabled by default.

  • lzss - Enabled by default.

  • std - By default, compression depends on libstd. However, it can be configured to use the unstable liballoc API instead, for use on platforms that have liballoc but not libstd. This configuration is currently unstable and is not guaranteed to work on all versions of Rust. To depend on compression without libstd, use default-features = false in the compression section of Cargo.toml to disable its "std" feature.

Examples

use compression::prelude::*;

fn main() {
    let compressed = b"aabbaabbaabbaabb\n"
        .into_iter()
        .cloned()
        .encode(&mut BZip2Encoder::new(9), Action::Finish)
        .collect::<Result<Vec<_>, _>>()
        .unwrap();

    let decompressed = compressed
        .iter()
        .cloned()
        .decode(&mut BZip2Decoder::new())
        .collect::<Result<Vec<_>, _>>()
        .unwrap();
}

Dependencies