doctor_diff_core/
hash.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Default, Clone, Serialize, Deserialize, PartialEq)]
4pub struct HashValue(pub Vec<u8>);
5
6impl ToString for HashValue {
7    fn to_string(&self) -> String {
8        let mut result = String::with_capacity(self.0.len() * 2);
9        for item in &self.0 {
10            result.push_str(&format!("{:02x}", item));
11        }
12        result
13    }
14}
15
16impl std::fmt::Debug for HashValue {
17    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18        f.write_str(&self.to_string())
19    }
20}