From 3a9b5526b33690ebb53fce0498e4430aa01fc654 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 24 May 2023 13:46:06 +1000 Subject: [PATCH] Move BlockHash From impls Move the `From` impls on `BlockHash` to below the `BlockHash` impl block. Code move only, no other changes. --- bitcoin/src/blockdata/block.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index b496787a..1db06b51 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -337,6 +337,22 @@ impl Block { } } +impl From
for BlockHash { + fn from(header: Header) -> BlockHash { header.block_hash() } +} + +impl From<&Header> for BlockHash { + fn from(header: &Header) -> BlockHash { header.block_hash() } +} + +impl From for BlockHash { + fn from(block: Block) -> BlockHash { block.block_hash() } +} + +impl From<&Block> for BlockHash { + fn from(block: &Block) -> BlockHash { block.block_hash() } +} + /// An error when looking up a BIP34 block height. #[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] @@ -375,22 +391,6 @@ impl std::error::Error for Bip34Error { } } -impl From
for BlockHash { - fn from(header: Header) -> BlockHash { header.block_hash() } -} - -impl From<&Header> for BlockHash { - fn from(header: &Header) -> BlockHash { header.block_hash() } -} - -impl From for BlockHash { - fn from(block: Block) -> BlockHash { block.block_hash() } -} - -impl From<&Block> for BlockHash { - fn from(block: &Block) -> BlockHash { block.block_hash() } -} - #[cfg(test)] mod tests { use hashes::hex::FromHex;