This commit is contained in:
AF 2023-09-03 18:55:47 +00:00
parent cfff3c39b9
commit 72845b59ff

View File

@ -39,6 +39,15 @@ pub(crate) fn hex(point: &Hash) -> impl '_ + Display {
Hex { point }
}
#[cfg(test)]
#[test]
fn hex_test() {
assert_eq!(
hex(&(0..32).collect::<Vec<_>>().try_into().unwrap()).to_string(),
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
);
}
impl Display for Address {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}@{}", hex(&self.point), self.index)