Expand description
§S2 Compression
This library implements the S2 compression format, which is an extension of Snappy. It is binary compatible with the Go implementation at github.com/klauspost/compress/s2
S2 provides:
- Better compression than Snappy
- Faster decompression
- Block and stream formats
- CRC validation for streams
§Block Format Example
use minlz::{encode, decode};
let data = b"Hello, World! This is a test of S2 compression.";
let compressed = encode(data);
let decompressed = decode(&compressed).expect("decompression failed");
assert_eq!(data, &decompressed[..]);Modules§
- crc
- CRC32 checksum implementation for S2 streams
Structs§
- Decoder
- Decoder for S2 and Snappy compression
- Dict
- Dictionary for S2 compression
- Encoder
- Encoder for S2 compression
- Index
- Index represents an S2/Snappy index for seeking support.
- Reader
- Reader decompresses data using the S2 stream format
- Writer
- Writer compresses data using the S2 stream format
Enums§
- Error
- Error types for S2 compression/decompression
Constants§
- MAX_
DICT_ SIZE - Maximum dictionary size
- MAX_
DICT_ SRC_ OFFSET - Maximum offset where a dictionary entry can start
- MIN_
DICT_ SIZE - Minimum dictionary size
Functions§
- decode
- Decode returns the decoded form of src. The returned slice may be a sub-slice of dst if dst was large enough to hold the entire decoded block. Otherwise, a newly allocated Vec will be returned.
- decode_
len - Returns the length of the decoded block and the number of bytes that the length header occupied.
- decode_
snappy - Decode Snappy format data This is an alias for decode() since S2 decoder handles Snappy format
- decode_
with_ dict - Decode with dictionary
- encode
- Encode returns the encoded form of src. The encoding is compatible with the Go s2 implementation.
- encode_
best - EncodeBest provides the best compression but is the slowest
- encode_
best_ with_ dict - Encode best with dictionary support
- encode_
better - EncodeBetter provides better compression than Encode but is slower
- encode_
better_ with_ dict - Encode better with dictionary support
- encode_
snappy - Encode using Snappy-compatible format (no repeat offsets)
- encode_
with_ dict - Encode with dictionary support
- make_
dict - Create a dictionary from data
- make_
dict_ manual - Create a dictionary with manual repeat offset
- max_
encoded_ len - Returns the maximum length of an encoded block
Type Aliases§
- Result
- Result type for S2 operations