Move impl block under struct
Put the impl block for `Midstate` under the struct, as is customary. (Note the diff shows moving some other code around the impl block not the impl block itself.) Code move only.
This commit is contained in:
parent
5941008733
commit
9efe4cea9d
|
@ -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<I: SliceIndex<[u8]>> Index<I> 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<Self, Self::Err> { 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<I: SliceIndex<[u8]>> Index<I> 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<Self, Self::Err> { hex::FromHex::from_hex(s) }
|
||||
}
|
||||
|
||||
impl hex::FromHex for Midstate {
|
||||
type Error = hex::HexToArrayError;
|
||||
|
||||
|
|
Loading…
Reference in New Issue