Crate minlz

Crate minlz 

Source
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