diff options
Diffstat (limited to 'src/assets.rs')
-rw-r--r-- | src/assets.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/assets.rs b/src/assets.rs index 80f9630..36fab55 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -2,6 +2,7 @@ use sha2::{Digest, Sha256}; use std::collections::HashMap; use std::fs; use std::iter::FromIterator; +use std::fmt::Write; pub fn get() -> HashMap<String, String> { let paths = fs::read_dir("assets").unwrap().map(|e| { @@ -19,9 +20,10 @@ pub fn get() -> HashMap<String, String> { fn sha256(input: Vec<u8>) -> String { let mut hasher = Sha256::new(); hasher.update(input); - hasher - .finalize() - .iter() - .map(|b| format!("{:x}", b)) - .collect() + + let mut res = String::new(); + for byte in hasher.finalize().iter() { + write!(&mut res, "{:x}", byte).unwrap(); + } + res } |