Module lz4_flex::block

source ·
Expand description

LZ4 Block Format

As defined in https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md

Currently for no_std support only the block format is supported.

§Example: block format roundtrip

use lz4_flex::block::{compress_prepend_size, decompress_size_prepended};
let input: &[u8] = b"Hello people, what's up?";
let compressed = compress_prepend_size(input);
let uncompressed = decompress_size_prepended(&compressed).unwrap();
assert_eq!(input, uncompressed);

Enums§

Functions§

  • Compress all bytes of input.
  • Compress all bytes of input into output. The method chooses an appropriate hashtable to lookup duplicates. output should be preallocated with a size of get_maximum_output_size.
  • Compress all bytes of input into output. The method chooses an appropriate hashtable to lookup duplicates. output should be preallocated with a size of get_maximum_output_size.
  • Compress all bytes of input into output. The uncompressed size will be prepended as a little endian u32. Can be used in conjunction with decompress_size_prepended
  • Compress all bytes of input into output. The uncompressed size will be prepended as a little endian u32. Can be used in conjunction with decompress_size_prepended_with_dict
  • Compress all bytes of input with an external dictionary.
  • Decompress all bytes of input into a new vec. The passed parameter min_uncompressed_size needs to be equal or larger than the uncompressed size.
  • Decompress all bytes of input into output. output should be preallocated with a size of of the uncompressed data.
  • Decompress all bytes of input into output.
  • Decompress all bytes of input into a new vec. The first 4 bytes are the uncompressed size in litte endian. Can be used in conjunction with compress_prepend_size
  • Decompress all bytes of input into a new vec. The first 4 bytes are the uncompressed size in little endian. Can be used in conjunction with compress_prepend_size_with_dict
  • Decompress all bytes of input into a new vec. The passed parameter min_uncompressed_size needs to be equal or larger than the uncompressed size.
  • Returns the maximum output size of the compressed data. Can be used to preallocate capacity on the output vector
  • This can be used in conjunction with decompress_size_prepended. It will read the first 4 bytes as little-endian encoded length, and return the rest of the bytes after the length encoding.