diff --git a/hashes/src/sha256.rs b/hashes/src/sha256.rs index 68fa277c7..e6bb03f12 100644 --- a/hashes/src/sha256.rs +++ b/hashes/src/sha256.rs @@ -123,22 +123,6 @@ impl Hash { #[derive(Copy, Clone, PartialEq, Eq, Default, PartialOrd, Ord, Hash)] pub struct Midstate(pub [u8; 32]); -crate::internal_macros::arr_newtype_fmt_impl!(Midstate, 32); -serde_impl!(Midstate, 32); -borrow_slice_impl!(Midstate); - -impl> Index for Midstate { - type Output = I::Output; - - #[inline] - fn index(&self, index: I) -> &Self::Output { &self.0[index] } -} - -impl core::str::FromStr for Midstate { - type Err = hex::HexToArrayError; - fn from_str(s: &str) -> Result { hex::FromHex::from_hex(s) } -} - impl Midstate { /// Length of the midstate, in bytes. const LEN: usize = 32; @@ -183,6 +167,22 @@ impl Midstate { } } +crate::internal_macros::arr_newtype_fmt_impl!(Midstate, 32); +serde_impl!(Midstate, 32); +borrow_slice_impl!(Midstate); + +impl> Index for Midstate { + type Output = I::Output; + + #[inline] + fn index(&self, index: I) -> &Self::Output { &self.0[index] } +} + +impl core::str::FromStr for Midstate { + type Err = hex::HexToArrayError; + fn from_str(s: &str) -> Result { hex::FromHex::from_hex(s) } +} + impl hex::FromHex for Midstate { type Error = hex::HexToArrayError;