Expand description
The zlib format (RFC 1950): a two-byte header, a DEFLATE stream and an Adler-32 trailer.
use pltrs_codec::{zlib, CompressionLevel};
let packed = zlib::compress(b"hello, hello, hello", CompressionLevel::DEFAULT)?;
assert_eq!(&packed[..2], [0x78, 0x9C]);
assert_eq!(zlib::decompress(&packed)?, b"hello, hello, hello");Structs§
- Compressor
- Compresses stream after stream with the same tables, for writers of
many streams (PDF’s): each stream is the one
compress_withwrites, without allocating and clearing the compressor’s 300 KiB of tables anew for each.
Enums§
- Zlib
Error - An error found while decoding a zlib stream.
Functions§
- compress
- Compresses
datainto a new zlib stream atlevel, as zlib-ng’scompress2does. - compress_
into - Appends the zlib compression of
dataatleveltoout. - compress_
with - Compresses
datainto a new zlib stream as zlib-ng does withoptions. - decompress
- Decompresses a complete zlib stream; trailing bytes are an error.
- decompress_
into - Decompresses the zlib stream at the start of
input, appending at mostlimitbytes toout, and returns the number of input bytes the stream occupied (bytes after it are left alone). - decompress_
with_ limit - Like
decompress, but fails instead of producing more thanlimitbytes.