pub struct Midstate(pub [u8; 32]);Expand description
Output of the SHA256 hash function.
Tuple Fields§
§0: [u8; 32]Implementations§
§impl Midstate
impl Midstate
pub fn from_byte_array(inner: [u8; 32]) -> Midstate
pub fn from_byte_array(inner: [u8; 32]) -> Midstate
Construct a new Midstate from the inner value.
pub fn from_slice(sl: &[u8]) -> Result<Midstate, Error>
pub fn from_slice(sl: &[u8]) -> Result<Midstate, Error>
Copies a byte slice into the Midstate object.
pub fn to_byte_array(self) -> [u8; 32]
pub fn to_byte_array(self) -> [u8; 32]
Unwraps the Midstate and returns the underlying byte array.
Trait Implementations§
§impl<'de> Deserialize<'de> for Midstate
impl<'de> Deserialize<'de> for Midstate
§fn deserialize<D>(d: D) -> Result<Midstate, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Midstate, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<I> Index<I> for Midstatewhere
I: SliceIndex<[u8]>,
impl<I> Index<I> for Midstatewhere I: SliceIndex<[u8]>,
§impl Ord for Midstate
impl Ord for Midstate
§impl PartialOrd<Midstate> for Midstate
impl PartialOrd<Midstate> for Midstate
§fn partial_cmp(&self, other: &Midstate) -> Option<Ordering>
fn partial_cmp(&self, other: &Midstate) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more§impl SerdeHash for Midstate
impl SerdeHash for Midstate
§fn from_slice_delegated(sl: &[u8]) -> Result<Midstate, Error>
fn from_slice_delegated(sl: &[u8]) -> Result<Midstate, Error>
Helper function to turn a deserialized slice into the correct hash type.
§fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, s: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Do serde serialization.
§fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Do serde deserialization.
§impl Serialize for Midstate
impl Serialize for Midstate
§fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, s: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Midstate
impl Eq for Midstate
impl StructuralEq for Midstate
impl StructuralPartialEq for Midstate
Auto Trait Implementations§
impl RefUnwindSafe for Midstate
impl Send for Midstate
impl Sync for Midstate
impl Unpin for Midstate
impl UnwindSafe for Midstate
Blanket Implementations§
§impl<T> Base32Len for Twhere
T: AsRef<[u8]>,
impl<T> Base32Len for Twhere T: AsRef<[u8]>,
§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> ToBase32 for Twhere
T: AsRef<[u8]>,
impl<T> ToBase32 for Twhere T: AsRef<[u8]>,
§fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where W: WriteBase32,
Encode as base32 and write it to the supplied writer
Implementations shouldn’t allocate.