From f8e093a19be2da26a4701ac0cc2845e5fe9f60b8 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Wed, 26 Oct 2022 11:31:26 +0200 Subject: [PATCH] eagerly derive all possible derives, more docs, new version --- Cargo.toml | 2 +- src/lib.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 62d671f..ceabdaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustyman" -version = "0.2.2" +version = "0.2.3" edition = "2021" authors = ["Edgar "] description = "Huffman compression and decompression" diff --git a/src/lib.rs b/src/lib.rs index 0ba5b22..1e335ea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,6 +22,10 @@ //! assert_eq!(&payload[..], decompressed); //! ``` +#![forbid(unsafe_code)] +#![deny(missing_docs)] +#![deny(rustdoc::missing_doc_code_examples)] + use std::{ cell::RefCell, collections::{BinaryHeap, HashMap}, @@ -77,7 +81,11 @@ impl Ord for Node { } } -#[derive(Debug, Clone)] +/// Holds the data needed to (de)compress. +/// +/// - Compress with [Self::compress] +/// - Decompress with [Self::decompress] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Huffman { tree: Vec, // index lookup table for the leaf nodes.