mirror of
https://github.com/edg-l/rustyman.git
synced 2024-09-19 09:12:20 +00:00
improve docs
This commit is contained in:
parent
c2b00e13a4
commit
9ec8459253
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "rustyman"
|
name = "rustyman"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Edgar <git@edgarluque.com>"]
|
authors = ["Edgar <git@edgarluque.com>"]
|
||||||
description = "Huffman compression and decompression"
|
description = "Huffman compression and decompression"
|
||||||
|
|
14
README.md
14
README.md
|
@ -1,6 +1,16 @@
|
||||||
# rustyman
|
# rustyman
|
||||||
|
|
||||||
|
|
||||||
|
[![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)
|
||||||
|
|
||||||
Huffman compression and decompression implemented in rust
|
Huffman compression and decompression implemented in rust
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use rustyman::Huffman;
|
use rustyman::Huffman;
|
||||||
|
|
||||||
|
@ -11,5 +21,7 @@ let compressed = huffman.compress(payload);
|
||||||
let decompressed = huffman.decompress(&compressed);
|
let decompressed = huffman.decompress(&compressed);
|
||||||
|
|
||||||
assert!(compressed.len() < payload.len());
|
assert!(compressed.len() < payload.len());
|
||||||
assert_eq!(&payload[..], decompressed)
|
assert_eq!(&payload[..], decompressed);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
License: MIT OR Apache-2.0
|
||||||
|
|
24
src/lib.rs
24
src/lib.rs
|
@ -1,3 +1,27 @@
|
||||||
|
//!
|
||||||
|
//! [![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)
|
||||||
|
//!
|
||||||
|
//! Huffman compression and decompression implemented in rust
|
||||||
|
//!
|
||||||
|
//! ## Example
|
||||||
|
//!
|
||||||
|
//! ```rust
|
||||||
|
//! use rustyman::Huffman;
|
||||||
|
//!
|
||||||
|
//! let payload = b"hello from the other side of the river";
|
||||||
|
//!
|
||||||
|
//! let huffman = Huffman::new_from_data(payload);
|
||||||
|
//! let compressed = huffman.compress(payload);
|
||||||
|
//! let decompressed = huffman.decompress(&compressed);
|
||||||
|
//!
|
||||||
|
//! assert!(compressed.len() < payload.len());
|
||||||
|
//! assert_eq!(&payload[..], decompressed);
|
||||||
|
//! ```
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::{BinaryHeap, HashMap},
|
collections::{BinaryHeap, HashMap},
|
||||||
|
|
Loading…
Reference in a new issue