#compress #gzip #deflate #no_std #bzip2

no-std compression

Compression libraries implemented by pure Rust

5 releases

0.1.4 Jun 6, 2019
0.1.3 Dec 26, 2018
0.1.2 Jul 22, 2018
0.1.1 May 26, 2018
0.1.0 Mar 23, 2018

#22 in Compression

Download history 58/week @ 2019-04-27 56/week @ 2019-05-04 60/week @ 2019-05-11 11/week @ 2019-05-18 28/week @ 2019-05-25 75/week @ 2019-06-01 52/week @ 2019-06-08 45/week @ 2019-06-15 84/week @ 2019-06-22 14/week @ 2019-06-29 57/week @ 2019-07-06 23/week @ 2019-07-13 48/week @ 2019-07-20 31/week @ 2019-07-27 105/week @ 2019-08-03

277 downloads per month
Used in 1 crate

MPL-2.0 license

411KB
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

extern crate compression;
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