1
2
3
4
5
6
7
8
9
10
fn byte_to_hex(byte: &u8) -> String {
format!("{:02x}", byte)
}
pub fn to_hex_string<T: Clone + Into<Vec<u8>>>(bytes: &T) -> String {
let hex_vec: Vec<String> = bytes.clone().into().iter().map(byte_to_hex).collect();
hex_vec.join("")
}