#encoder #decoding #bit #en

unmaintained lzw

LZW compression and decompression

8 breaking releases

Uses old Rust 2015

0.10.0 Feb 28, 2016
0.9.0 Jun 7, 2015
0.8.0 Jun 5, 2015

#686 in Compression

Download history 13275/week @ 2024-03-14 12512/week @ 2024-03-21 26373/week @ 2024-03-28 8976/week @ 2024-04-04 10572/week @ 2024-04-11 10543/week @ 2024-04-18 10625/week @ 2024-04-25 8394/week @ 2024-05-02 8306/week @ 2024-05-09 15897/week @ 2024-05-16 16196/week @ 2024-05-23 10385/week @ 2024-05-30 15899/week @ 2024-06-06 11465/week @ 2024-06-13 11892/week @ 2024-06-20 12513/week @ 2024-06-27

53,603 downloads per month
Used in 398 crates (7 directly)

MIT/Apache

23KB
582 lines

lzw

LZW en- and decoding


lib.rs:

LZW decoder and encoder

This crates provides a LzwEncoder and LzwDecoder. The code words are written from and to bit streams where it is possible to write either the most or least significant bit first. The maximum possible code size is 16 bits. Both types rely on RAII to produced correct results.

The de- and encoder expect the LZW stream to start with a clear code and end with an end code which are defined as follows:

  • CLEAR_CODE == 1 << min_code_size
  • END_CODE == CLEAR_CODE + 1

Examplary use of the encoder:

 use lzw::{LsbWriter, Encoder};
 let size = 8;
 let data = b"TOBEORNOTTOBEORTOBEORNOT";
 let mut compressed = vec![];
 {
     let mut enc = Encoder::new(LsbWriter::new(&mut compressed), size).unwrap();
     enc.encode_bytes(data).unwrap();
 }

No runtime deps

Features