rustyman/README.md

28 lines
847 B
Markdown
Raw Normal View History

2022-10-25 11:13:48 +00:00
# rustyman
2022-10-26 09:14:48 +00:00
[![Version](https://img.shields.io/crates/v/rustyman)](https://crates.io/crates/rustyman)
[![Downloads](https://img.shields.io/crates/d/rustyman)](https://crates.io/crates/rustyman)
[![License](https://img.shields.io/crates/l/rustyman)](https://crates.io/crates/rustyman)
![Rust](https://github.com/edg-l/rustyman/workflows/Rust/badge.svg)
[![Docs](https://docs.rs/rustyman/badge.svg)](https://docs.rs/rustyman)
2022-10-25 11:13:48 +00:00
Huffman compression and decompression implemented in rust
2022-10-26 09:14:48 +00:00
### Example
2022-10-25 11:13:48 +00:00
```rust
use rustyman::Huffman;
let payload = b"hello from the other side of the river";
2022-10-26 09:14:48 +00:00
2022-10-25 11:13:48 +00:00
let huffman = Huffman::new_from_data(payload);
let compressed = huffman.compress(payload);
let decompressed = huffman.decompress(&compressed);
assert!(compressed.len() < payload.len());
2022-10-26 09:14:48 +00:00
assert_eq!(&payload[..], decompressed);
2022-10-25 11:13:48 +00:00
```
2022-10-26 09:14:48 +00:00
License: MIT OR Apache-2.0