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 ofLZ4_compress_HC.- LZ4HC_
CLEVEL_ MAX LZ4HC_CLEVEL_MAX: the maximum compression level ofLZ4_compress_HC.- LZ4HC_
CLEVEL_ MIN LZ4HC_CLEVEL_MIN: the minimum compression level ofLZ4_compress_HC.- LZ4HC_
CLEVEL_ OPT_ MIN LZ4HC_CLEVEL_OPT_MIN: the minimum compression level ofLZ4_compress_HCthat 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/lz4does not override it, so this isLZ4_MEMORY_USAGE_DEFAULT.- LZ4_
STREAM_ MINSIZE LZ4_STREAM_MINSIZE: the size ofLZ4_stream_t.
Functions§
- LZ4_
compress ⚠Bound LZ4_compressBound(): returns the maximum size of the output of compressinginputSizebytes, or 0 ifinputSizeis larger thanLZ4_MAX_INPUT_SIZE.- LZ4_
compress_ ⚠HC LZ4_compress_HC(): compressessrcSizebytes fromsrcinto thedstCapacitybyte bufferdstusing the high compression (HC) algorithm atcompressionLevel. Returns the number of bytes written todst, or 0 if compression fails. Compression is guaranteed to succeed ifdstCapacity >= LZ4_compressBound(srcSize).- LZ4_
compress_ ⚠default LZ4_compress_default(): compressessrcSizebytes fromsrcinto thedstCapacitybyte bufferdst. Returns the number of bytes written todst, or 0 if compression fails. Compression is guaranteed to succeed ifdstCapacity >= LZ4_compressBound(srcSize).- LZ4_
compress_ ⚠fast_ extState_ fast Reset LZ4_compress_fast_extState_fastReset(): compressessrcSizebytes fromsrcinto thedstCapacitybyte bufferdst, using theaccelerationfactor and theLZ4_stream_tstate. Returns the number of bytes written todst, or 0 if compression fails.- LZ4_
decompress_ ⚠safe LZ4_decompress_safe(): decompresses the complete compressed block ofcompressedSizebytes fromsrcinto thedstCapacitybyte bufferdst. Returns the number of bytes written todst, or a negative value ifdstis too small orsrcis malformed.- LZ4_
init ⚠Stream LZ4_initStream(): initializes thesizebyte bufferbufferas anLZ4_stream_t. Returnsbufferon success, or null ifsizeis too small orbufferis not aligned correctly.