Skip to content

Commit c0e6b13

Browse files
committed
add display for hashes
1 parent 9818300 commit c0e6b13

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rust/src/crypto.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use crypto::bech32::Bech32 as _;
77
use rand_os::OsRng;
88
use std::io::{BufRead, Seek, Write};
99
use std::str::FromStr;
10+
use std::fmt::Display;
11+
use std::fmt;
1012

1113
use cryptoxide::blake2b::Blake2b;
1214

@@ -1062,6 +1064,12 @@ macro_rules! impl_hash_type {
10621064
String::is_referenceable()
10631065
}
10641066
}
1067+
1068+
impl Display for $name {
1069+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1070+
write!(f, "{}", self.to_hex())
1071+
}
1072+
}
10651073
};
10661074
}
10671075

0 commit comments

Comments
 (0)