lzallright 0.1.0

LZO compression in safe Rust, ported from LZ👌 (lzokay)
Documentation
  • Coverage
  • 100%
    12 out of 12 items documented4 out of 4 items with examples
  • Size
  • Source code size: 63.5 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 289.8 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • vlaci/lzallright
    2 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vlaci

The crate is started as a port of the C++ lzokay library.

LZO compresses a block of data into matches (a sliding dictionary) and runs of non-matching literals to produce good results on highly redundant data

— Wikipedia

There is no publicly available documentation of the LZO format. A good introduction is available in the Linux Kernel documentation

The crate is no_std. Decompression works without any allocation. For compression, a [Dict] instance is needed.

Examples

use lzallright::{compress, decompress, worst_case_len, Dict};

let input = b"hello world";

// You should reuse the dictionary across calls.
let mut dict = Dict::new();
let mut compressed = vec![0u8; worst_case_len(input.len())];
let n = compress(input, &mut compressed, &mut dict).unwrap();
compressed.truncate(n);

let mut output = vec![0u8; input.len()];
let m = decompress(&compressed, &mut output).unwrap();
assert_eq!(&output[..m], input);