Skip to content

Commit

Permalink
Merge pull request #470 from Xuanwo/update-readme-for-zlib-rs
Browse files Browse the repository at this point in the history
docs: Update README to promote zlib-rs
  • Loading branch information
Byron authored Feb 28, 2025
2 parents 70de9df + e6aed50 commit 9428b70
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,17 @@ fn main() {

## Backends

The default `miniz_oxide` backend has the advantage of being pure Rust. If you
want maximum performance, you can use the zlib-ng C library:
The default `miniz_oxide` backend has the advantage of being pure Rust.

If you want maximum performance while still benefiting from a pure rust
implementation, you can use `zlib-rs`:

```toml
[dependencies]
flate2 = { version = "1.0.17", features = ["zlib-rs"], default-features = false }
```

Or, you can use the zlib-ng C library:

```toml
[dependencies]
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
//! crate which is a port of `miniz.c` (below) to Rust. This feature does not
//! require a C compiler and only requires Rust code.
//!
//! * `zlib-rs` - this implementation utilizes the `zlib-rs` crate, a pure rust rewrite of zlib.
//! This backend is faster than both `rust_backend` and `zlib`. However, we did not set it as the
//! default choice to prevent compatibility issues.
//!
//! * `zlib` - this feature will enable linking against the `libz` library, typically found on most
//! Linux systems by default. If the library isn't found to already be on the system it will be
//! compiled from source (this is a C library).
Expand Down

0 comments on commit 9428b70

Please # to comment.