Skip to content

Commit 8210288

Browse files
committed
Document backend differences
1 parent 6fbd6d2 commit 8210288

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,17 @@ impl Compression {
193193
/// The integer here is typically on a scale of 0-9 where 0 means "no
194194
/// compression" and 9 means "take as long as you'd like".
195195
///
196-
/// It is worth noting that `flate2` supports both `zlib` and `miniz`
197-
/// backends for compression, where `miniz` also provides a level `10` of
198-
/// compression.
196+
/// ### Backend differences
197+
///
198+
/// The [`miniz_oxide`](https://crates.io/crates/miniz_oxide) backend for flate2
199+
/// does not support level 0 or `Compression::none()`. Instead it interprets them
200+
/// as the default compression level. Using `Compression::fast()` is recommended instead
201+
/// when using the `miniz_oxide` backend.
202+
///
203+
/// `miniz_oxide` also supports a non-compliant compression level 10.
204+
/// It is even slower and may result in higher compression, but
205+
/// **only miniz_oxide will be able to read the data** compressed with level 10.
206+
/// Do **not** use level 10 if you need other software to be able to read it!
199207
pub const fn new(level: u32) -> Compression {
200208
Compression(level)
201209
}
@@ -217,7 +225,7 @@ impl Compression {
217225
}
218226

219227
/// Returns an integer representing the compression level, typically on a
220-
/// scale of 0-9. With `miniz` backend, level 10 is also possible.
228+
/// scale of 0-9. See [`new`](Self::new) for details about compression levels.
221229
pub fn level(&self) -> u32 {
222230
self.0
223231
}

0 commit comments

Comments
 (0)