Add 0x when printing hex values.
This commit is contained in:
parent
3fe9fe605b
commit
c06346cc4b
12
src/hash.rs
12
src/hash.rs
|
@ -119,15 +119,14 @@ macro_rules! construct_hash {
|
|||
|
||||
impl ::core::fmt::Debug for $from {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
for i in &self.0[..] {
|
||||
write!(f, "{:02x}", i)?;
|
||||
}
|
||||
Ok(())
|
||||
write!(f, "0x")?;
|
||||
::core::fmt::LowerHex::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::core::fmt::Display for $from {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
write!(f, "0x")?;
|
||||
for i in &self.0[0..2] {
|
||||
write!(f, "{:02x}", i)?;
|
||||
}
|
||||
|
@ -141,7 +140,10 @@ macro_rules! construct_hash {
|
|||
|
||||
impl ::core::fmt::LowerHex for $from {
|
||||
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
|
||||
::core::fmt::Debug::fmt(self, f)
|
||||
for i in &self.0[..] {
|
||||
write!(f, "{:02x}", i)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue