Merge pull request #529 from zcash/improve-debug-impls
Improve various `Debug` impls
This commit is contained in:
commit
514dfd4ee9
|
@ -9,9 +9,18 @@ use zcash_encoding::Vector;
|
|||
|
||||
pub use equihash;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct BlockHash(pub [u8; 32]);
|
||||
|
||||
impl fmt::Debug for BlockHash {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
// The (byte-flipped) hex string is more useful than the raw bytes, because we can
|
||||
// look that up in RPC methods and block explorers.
|
||||
let block_hash_str = self.to_string();
|
||||
f.debug_tuple("BlockHash").field(&block_hash_str).finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for BlockHash {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut data = self.0;
|
||||
|
|
|
@ -61,9 +61,18 @@ const ZFUTURE_VERSION_GROUP_ID: u32 = 0xFFFFFFFF;
|
|||
#[cfg(feature = "zfuture")]
|
||||
const ZFUTURE_TX_VERSION: u32 = 0x0000FFFF;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
|
||||
#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)]
|
||||
pub struct TxId([u8; 32]);
|
||||
|
||||
impl fmt::Debug for TxId {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
// The (byte-flipped) hex string is more useful than the raw bytes, because we can
|
||||
// look that up in RPC methods and block explorers.
|
||||
let txid_str = self.to_string();
|
||||
f.debug_tuple("TxId").field(&txid_str).finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for TxId {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut data = self.0;
|
||||
|
|
Loading…
Reference in New Issue