Skip to main content

Crate lz4_sys

Crate lz4_sys 

Source
Expand description

Raw FFI bindings to the LZ4 library built by //third_party/lz4, which this crate also links.

These are hand-written declarations of the subset of lz4.h and lz4hc.h that is used from Rust, and must be kept in sync with those headers and the defines that //third_party/lz4 is built with. This crate is no_std so that it can also be used by the kernel.

Structs§

LZ4_stream_t
LZ4_stream_t: the state used by the LZ4 streaming and external state compression functions.

Constants§

LZ4HC_CLEVEL_DEFAULT
LZ4HC_CLEVEL_DEFAULT: the default compression level of LZ4_compress_HC.
LZ4HC_CLEVEL_MAX
LZ4HC_CLEVEL_MAX: the maximum compression level of LZ4_compress_HC.
LZ4HC_CLEVEL_MIN
LZ4HC_CLEVEL_MIN: the minimum compression level of LZ4_compress_HC.
LZ4HC_CLEVEL_OPT_MIN
LZ4HC_CLEVEL_OPT_MIN: the minimum compression level of LZ4_compress_HC that uses the optimal parser.
LZ4_MAX_INPUT_SIZE
LZ4_MAX_INPUT_SIZE: the maximum number of bytes that LZ4 can compress in one call.
LZ4_MEMORY_USAGE
LZ4_MEMORY_USAGE: log2 of the size of the hash table used for compression. //third_party/lz4 does not override it, so this is LZ4_MEMORY_USAGE_DEFAULT.
LZ4_STREAM_MINSIZE
LZ4_STREAM_MINSIZE: the size of LZ4_stream_t.

Functions§

LZ4_compressBound⚠
LZ4_compressBound(): returns the maximum size of the output of compressing inputSize bytes, or 0 if inputSize is larger than LZ4_MAX_INPUT_SIZE.
LZ4_compress_HC⚠
LZ4_compress_HC(): compresses srcSize bytes from src into the dstCapacity byte buffer dst using the high compression (HC) algorithm at compressionLevel. Returns the number of bytes written to dst, or 0 if compression fails. Compression is guaranteed to succeed if dstCapacity >= LZ4_compressBound(srcSize).
LZ4_compress_default⚠
LZ4_compress_default(): compresses srcSize bytes from src into the dstCapacity byte buffer dst. Returns the number of bytes written to dst, or 0 if compression fails. Compression is guaranteed to succeed if dstCapacity >= LZ4_compressBound(srcSize).
LZ4_compress_fast_extState_fastReset⚠
LZ4_compress_fast_extState_fastReset(): compresses srcSize bytes from src into the dstCapacity byte buffer dst, using the acceleration factor and the LZ4_stream_t state. Returns the number of bytes written to dst, or 0 if compression fails.
LZ4_decompress_safe⚠
LZ4_decompress_safe(): decompresses the complete compressed block of compressedSize bytes from src into the dstCapacity byte buffer dst. Returns the number of bytes written to dst, or a negative value if dst is too small or src is malformed.
LZ4_initStream⚠
LZ4_initStream(): initializes the size byte buffer buffer as an LZ4_stream_t. Returns buffer on success, or null if size is too small or buffer is not aligned correctly.