crabmail

Static HTML email archive viewer in Rust
git clone git://git.alexwennerberg.com/crabmail
Log | Files | Refs | README | LICENSE

commit 74c96b52f5e45a414357cc10ad4f425452eca8d6
parent 0c163e6fa14b8deb11f2fa45632c2e8cca9a9913
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Wed, 15 Dec 2021 00:34:49 -0800

Remove hex dependency

Diffstat:
MCargo.lock | 7-------
MCargo.toml | 1-
Msrc/main.rs | 8++++++--
3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -152,7 +152,6 @@ dependencies = [ "ammonia", "anyhow", "askama", - "hex", "linkify", "mailparse", "mbox-reader", @@ -240,12 +239,6 @@ dependencies = [ ] [[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] name = "html5ever" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml @@ -14,7 +14,6 @@ html = ["ammonia"] ammonia = {version = "3", optional = true} anyhow = "1.0" askama = {version = "0.10", default_feature = false} -hex = "0.4" linkify = "0.8.0" mailparse = "0.13" mbox-reader = "0.2.0" #unamaintained, should remove dep diff --git a/src/main.rs b/src/main.rs @@ -1,6 +1,5 @@ use anyhow::{anyhow, Context, Result}; use askama::Template; -use hex; use mailparse::*; use mbox_reader::MboxFile; use sha3::{ @@ -76,7 +75,12 @@ impl Email { let mut reader = hasher.finalize_xof(); let mut res1 = [0u8; 6]; XofReader::read(&mut reader, &mut res1); - return hex::encode(&res1); + let mut out = String::new(); + for byte in &res1 { + use std::fmt::Write; // TODO + write!(out, "{:02x}", byte).unwrap(); + } + return out; } }