lzf-rust
Pure Rust LZF compression/decompression library.
lzf-rust supports raw LZF token streams, framed ZV block streams, and
streaming adapters for both std and no_std + alloc environments.
Features
- Safe Rust raw LZF encoder/decoder (
liblzfcompatible token format) ZVblock framing support compatible with thelzfutility stream formatstd::ioadapters:LzfReaderandLzfWriterfor framed streaming I/O- crate-level
LzfRead/LzfWritetraits forno_stdstreaming no_stdsupport (withalloc)
Installation
[]
= "0.1"
no_std usage:
[]
= { = "0.1", = false, = ["encoder"] }
Usage
Raw LZF roundtrip:
use ;
let input = b"hello hello hello hello";
let mut compressed = vec!;
let n = compress.unwrap;
compressed.truncate;
let mut decompressed = vec!;
let m = decompress.unwrap;
assert_eq!;
assert_eq!;
Framed block API:
use ;
let input = b"hello framed world";
let framed = encode_blocks.unwrap;
let decoded = decode_blocks.unwrap;
assert_eq!;
Streaming API:
use ;
let input = b"streaming example";
let framed = encode_blocks.unwrap;
let mut src: & = &framed;
let mut reader = new;
let mut out = vec!;
reader.read_exact.unwrap;
assert_eq!;
License
This crate uses file-level licensing:
src/raw/encoder.rsis derived fromliblzfencoder logic and is licensed under BSD-2-Clause.- The from-scratch Rust implementation files are licensed under ISC.
License texts are provided in:
LICENSES/BSD-2-Clause-liblzf.txtLICENSES/ISC.txt