lzf 0.2.1

A small wrapper around LibLZF, a very small data compression library
docs.rs failed to build lzf-0.2.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: lzf-1.0.0

LZF - a very small data compression library

LibLZF is a super small and fast compression library, originally written by Marc Lehmann. It's written in C and consists of only 4 files.

Instead of rewriting the whole thing in Rust, I used Rust's Foreign Function Interface and wrote a wrapper. The whole Rust code is under 50 lines (yes, there is more test code than actual implementation code). And it is super easy to use, though I'm not happy with the current interface.

Build

cargo build --release

Usage

use lzf;

fn main() {
  let data = "foobar";

  let compressed = lzf::compress(data.as_bytes()).unwrap();

  let decompressed = lzf::decompress(compressed.as_slice(), data.len()).unwrap();
}

Tests

Run tests with:

cargo test

Run benchmarks with:

cargo bench

Contribute

If you find bugs or want to help otherwise, please open an issue.
This is my first released library in Rust and I'm still learning. So if there are better ways to do things in Rust, I'm happy to hear about it.

License

BSD. See LICENSE.
liblzf is BSD as well. See lzf.h.