A fully safe, pure rust replacement for the miniz DEFLATE/zlib encoder/decoder.
The main intention of this crate is to be used as a back-end for the flate2, but it can also be used on it's own. Using flate2 with the
rust_backend feature provides an easy to use streaming API for miniz_oxide.
The library is fully no_std. By default, the
with-alloc feature is enabled, which requires the use of the
collection crates as it allocates memory.
std feature additionally turns on things only available if
no_std is not used. Currently this only means implementing Error for the
DecompressError error struct returned by the simple decompression functions if enabled together with
Using the library with
default-features = false removes the dependency on
collection crates, making it suitable for systems without an allocator.
Running without allocation reduces crate functionality:
deflatemodule is removed complete
inflatefunctions which return a
miniz_oxide 0.5.x and 0.6.x Requires at least rust 1.40.0 0.3.x requires at least rust 0.36.0.
miniz_oxide features no use of unsafe code.
miniz_oxide can optionally be made to use a simd-accelerated version of adler32 via the simd-adler32 crate by enabling the 'simd' feature. This is not enabled by default as due to the use of simd intrinsics, the simd-adler32 has to use unsafe. The default setup uses the adler crate which features no unsafe code.
use compress_to_vec; use decompress_to_vec;
These simple functions will do everything in one go and are thus not recommended for use cases outside of prototyping/testing as real world data can have any size and thus result in very large memory allocations for the output Vector. Consider using miniz_oxide via flate2 which makes it easy to do streaming (de)compression or the low-level streaming functions instead.