1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
pub trait ToHex { fn to_hex(&self) -> String; } impl ToHex for Vec<u8> { fn to_hex(&self) -> String { hex::encode(self) } } impl ToHex for [u8] { fn to_hex(&self) -> String { hex::encode(self) } }