|
102 | 102 | //! - [`TransactionSpentOutputsIter`] - Iterates over coins spent by a transaction |
103 | 103 | //! |
104 | 104 |
|
105 | | -use std::{ffi::c_void, marker::PhantomData}; |
| 105 | +use std::{ |
| 106 | + ffi::c_void, |
| 107 | + fmt::{self, Debug, Display, Formatter}, |
| 108 | + marker::PhantomData, |
| 109 | +}; |
106 | 110 |
|
107 | 111 | use libbitcoinkernel_sys::{ |
108 | 112 | btck_Block, btck_BlockHash, btck_BlockSpentOutputs, btck_Coin, btck_TransactionSpentOutputs, |
@@ -146,7 +150,7 @@ use super::transaction::{TransactionRef, TxOutRef}; |
146 | 150 | /// let hash = BlockHash::from([1u8; 32]); |
147 | 151 | /// display_hash(&hash); |
148 | 152 | /// ``` |
149 | | -pub trait BlockHashExt: AsPtr<btck_BlockHash> { |
| 153 | +pub trait BlockHashExt: AsPtr<btck_BlockHash> + Display { |
150 | 154 | /// Serializes the block hash to raw bytes. |
151 | 155 | /// |
152 | 156 | /// Returns the 32-byte representation of the block hash in internal byte order. |
@@ -322,14 +326,14 @@ impl PartialEq for BlockHash { |
322 | 326 |
|
323 | 327 | impl Eq for BlockHash {} |
324 | 328 |
|
325 | | -impl std::fmt::Debug for BlockHash { |
326 | | - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 329 | +impl Debug for BlockHash { |
| 330 | + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result { |
327 | 331 | write!(f, "BlockHash({:?})", self.to_bytes()) |
328 | 332 | } |
329 | 333 | } |
330 | 334 |
|
331 | | -impl std::fmt::Display for BlockHash { |
332 | | - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 335 | +impl Display for BlockHash { |
| 336 | + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { |
333 | 337 | let bytes = self.to_bytes(); |
334 | 338 | for byte in bytes.iter().rev() { |
335 | 339 | write!(f, "{:02x}", byte)?; |
@@ -396,14 +400,14 @@ impl<'a> PartialEq for BlockHashRef<'a> { |
396 | 400 | } |
397 | 401 | } |
398 | 402 |
|
399 | | -impl<'a> std::fmt::Debug for BlockHashRef<'a> { |
400 | | - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 403 | +impl<'a> Debug for BlockHashRef<'a> { |
| 404 | + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { |
401 | 405 | write!(f, "BlockHash({:?})", self.to_bytes()) |
402 | 406 | } |
403 | 407 | } |
404 | 408 |
|
405 | | -impl<'a> std::fmt::Display for BlockHashRef<'a> { |
406 | | - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 409 | +impl<'a> Display for BlockHashRef<'a> { |
| 410 | + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { |
407 | 411 | let bytes = self.to_bytes(); |
408 | 412 | for byte in bytes.iter().rev() { |
409 | 413 | write!(f, "{:02x}", byte)?; |
|
0 commit comments