mirror of
https://github.com/mimblewimble/grin.git
synced 2025-05-08 18:21:14 +03:00
Strip hash in fmt::Debug and use fmt::Debug for fmt::Display
This commit is contained in:
parent
bc7b701de3
commit
94974ec19a
1 changed files with 5 additions and 5 deletions
|
@ -38,16 +38,16 @@ pub struct Hash([u8; 32]);
|
|||
|
||||
impl fmt::Debug for Hash {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.to_hex())
|
||||
let hash_hex = self.to_hex();
|
||||
const NUM_SHOW: usize = 12;
|
||||
|
||||
write!(f, "{}...", &hash_hex[..NUM_SHOW])
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Hash {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let hash_hex = self.to_hex();
|
||||
const NUM_SHOW: usize = 12;
|
||||
|
||||
write!(f, "{}...", &hash_hex[..NUM_SHOW])
|
||||
fmt::Debug::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue