Skip to content

Commit

Permalink
Debug format Blake3HashHex as hex
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Sep 11, 2024
1 parent 9e3812c commit 4ae72b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/subspace-core-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ pub type Blake3Hash = [u8; BLAKE3_HASH_SIZE];
/// BLAKE3 hash output wrapper, which serializes it as a hex string
// TODO: rename this type to Blake3Hash into a newtype, after checking for any breaking changes
#[derive(
Debug,
Default,
Copy,
Clone,
Expand All @@ -107,6 +106,12 @@ pub type Blake3Hash = [u8; BLAKE3_HASH_SIZE];
#[cfg_attr(feature = "serde", serde(transparent))]
pub struct Blake3HashHex(#[cfg_attr(feature = "serde", serde(with = "hex"))] Blake3Hash);

impl fmt::Debug for Blake3HashHex {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", hex::encode(self.0))
}
}

/// Type of randomness.
#[derive(
Debug,
Expand Down

0 comments on commit 4ae72b9

Please sign in to comment.