dubp_common/
block_hash.rs

1use crate::*;
2
3/// Wrapper of a block hash.
4#[derive(Copy, Clone, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
5pub struct BlockHash(pub Hash);
6
7impl Display for BlockHash {
8    fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
9        write!(f, "{}", self.0.to_hex())
10    }
11}
12
13impl Debug for BlockHash {
14    fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
15        write!(f, "BlockHash({})", self)
16    }
17}