Skip to main content

Crate lz4

Crate lz4 

Source
Expand description

lz4r — a pure-Rust implementation of the LZ4 compression algorithms and command-line programs (equivalent to the programs/ tree of LZ4 v1.10.0).

§Crate layout

ModuleContents
blockLow-level block compression and decompression (LZ4 spec §§ 1–3).
frameLZ4 Frame format (magic number, header, content checksum).
hcHigh-compression (lz4hc) encoder variants.
ioFile-level I/O: compress / decompress single and multiple files.
fileStreaming Read/Write wrappers over the Frame API.
cliCommand-line argument parsing and dispatch.
benchThroughput benchmarking infrastructure.
xxhashXXH32 content-checksum wrapper.
loremDeterministic lorem ipsum generator (benchmark corpus).
timefnMonotonic high-resolution timer.
threadpoolFixed-size work-stealing thread pool.
configCompile-time configuration constants.
utilFile enumeration and sizing utilities.

Re-exports§

pub use block::compress::compress_default as lz4_compress_default;
pub use block::decompress_api::decompress_safe as lz4_decompress_safe;
pub use block::compress_bound;
pub use block::compress_dest_size;
pub use block::compress_fast;
pub use block::decompress_safe_partial;
pub use block::decompress_safe_using_dict;
pub use block::Lz4Error;
pub use block::LZ4_ACCELERATION_DEFAULT;
pub use block::LZ4_ACCELERATION_MAX;
pub use block::LZ4_MAX_INPUT_SIZE;
pub use block::decompress_core::DecompressError;
pub use frame::lz4f_compress_frame;
pub use frame::lz4f_decompress;

Modules§

bench
Benchmark entry points for lz4r.
block
LZ4 block compression and decompression.
cli
Command-line interface for the lz4 binary.
config
Compile-time configuration constants for the lz4r programs layer.
file
LZ4 file-level streaming I/O — Rust port of lz4file.c / lz4file.h v1.10.0.
frame
LZ4 Frame format — streaming compression and decompression.
hc
LZ4 HC (high-compression) block codec.
io
Public API surface for LZ4 file I/O operations.
lorem
Deterministic lorem ipsum text generator.
threadpool
Fixed-size work-stealing thread pool.
timefn
Portable high-resolution monotonic timer.
util
Cross-cutting utility functions used by the CLI and I/O layers.
xxhash
Thin wrapper around the xxhash-rust crate providing the XXH32 API used by the rest of this crate (mirrors xxhash.c / xxhash.h from LZ4 v1.10.0).

Macros§

debugoutput
Write a formatted message to stderr in debug builds only.
display
Write a formatted message to stderr unconditionally.
displaylevel
Write a formatted message to stderr if the current verbosity level is at least level.
displayout
Write a formatted message to stdout.
end_process
Print an error diagnostic and exit the process with the given code.

Constants§

COMPRESS_INPLACE_MARGIN
LZ4_DISTANCE_MAX
LZ4_GIT_COMMIT_STRING
Git commit hash string injected at build time via the LZ4_GIT_COMMIT environment variable. Empty when the variable is not set.
LZ4_VERSION_MAJOR
LZ4_VERSION_MINOR
LZ4_VERSION_NUMBER
LZ4_VERSION_RELEASE
LZ4_VERSION_STRING

Functions§

compress_inplace_buffer_size
Minimum buffer size for in-place compression (lz4.h line 678).
decompress_inplace_buffer_size
Minimum buffer size for in-place decompression (lz4.h line 672).
decompress_inplace_margin
Margin required for in-place decompression (lz4.h line 670).
size_of_state
Returns the size in bytes of the internal stream state (LZ4_sizeofState()).
version_number
Returns the runtime version number (equivalent to LZ4_versionNumber()).
version_string
Returns the runtime version string (equivalent to LZ4_versionString()).