#[repr(transparent)]pub struct Hash<T>(_, _)
where
T: Tag;
Expand description
Output of the SHA256t hash function.
Implementations§
§impl<T> Hash<T>where
T: Tag,
impl<T> Hash<T>where T: Tag,
pub fn forward_hex(&self) -> impl LowerHex + UpperHex
pub fn forward_hex(&self) -> impl LowerHex + UpperHex
Displays hex forwards, regardless of how this type would display it naturally.
This is mainly intended as an internal method and you shouldn’t need it unless you’re doing something special.
pub fn backward_hex(&self) -> impl LowerHex + UpperHex
pub fn backward_hex(&self) -> impl LowerHex + UpperHex
Displays hex backwards, regardless of how this type would display it naturally.
This is mainly intended as an internal method and you shouldn’t need it unless you’re doing something special.
Trait Implementations§
§impl<'de, T> Deserialize<'de> for Hash<T>where
T: Tag,
impl<'de, T> Deserialize<'de> for Hash<T>where T: Tag,
§fn deserialize<D>(d: D) -> Result<Hash<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Hash<T>, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl From<Hash<TapBranchTag>> for TapNodeHash
impl From<Hash<TapBranchTag>> for TapNodeHash
§fn from(inner: Hash<TapBranchTag>) -> TapNodeHash
fn from(inner: Hash<TapBranchTag>) -> TapNodeHash
Converts to this type from the input type.
§impl From<Hash<TapLeafTag>> for TapLeafHash
impl From<Hash<TapLeafTag>> for TapLeafHash
§fn from(inner: Hash<TapLeafTag>) -> TapLeafHash
fn from(inner: Hash<TapLeafTag>) -> TapLeafHash
Converts to this type from the input type.
§impl From<Hash<TapSighashTag>> for TapSighash
impl From<Hash<TapSighashTag>> for TapSighash
§fn from(inner: Hash<TapSighashTag>) -> TapSighash
fn from(inner: Hash<TapSighashTag>) -> TapSighash
Converts to this type from the input type.
§impl From<Hash<TapTweakTag>> for TapTweakHash
impl From<Hash<TapTweakTag>> for TapTweakHash
§fn from(inner: Hash<TapTweakTag>) -> TapTweakHash
fn from(inner: Hash<TapTweakTag>) -> TapTweakHash
Converts to this type from the input type.
§impl From<TapLeafHash> for Hash<TapLeafTag>
impl From<TapLeafHash> for Hash<TapLeafTag>
§fn from(hashtype: TapLeafHash) -> Hash<TapLeafTag>
fn from(hashtype: TapLeafHash) -> Hash<TapLeafTag>
Converts to this type from the input type.
§impl From<TapNodeHash> for Hash<TapBranchTag>
impl From<TapNodeHash> for Hash<TapBranchTag>
§fn from(hashtype: TapNodeHash) -> Hash<TapBranchTag>
fn from(hashtype: TapNodeHash) -> Hash<TapBranchTag>
Converts to this type from the input type.
§impl From<TapSighash> for Hash<TapSighashTag>
impl From<TapSighash> for Hash<TapSighashTag>
§fn from(hashtype: TapSighash) -> Hash<TapSighashTag>
fn from(hashtype: TapSighash) -> Hash<TapSighashTag>
Converts to this type from the input type.
§impl From<TapTweakHash> for Hash<TapTweakTag>
impl From<TapTweakHash> for Hash<TapTweakTag>
§fn from(hashtype: TapTweakHash) -> Hash<TapTweakTag>
fn from(hashtype: TapTweakHash) -> Hash<TapTweakTag>
Converts to this type from the input type.
§impl<T> Hash for Hash<T>where
T: Tag,
impl<T> Hash for Hash<T>where T: Tag,
§type Engine = HashEngine
type Engine = HashEngine
A hashing engine which bytes can be serialized into. It is expected
to implement the
io::Write
trait, and to never return errors under
any conditions.§const DISPLAY_BACKWARD: bool = true
const DISPLAY_BACKWARD: bool = true
Flag indicating whether user-visible serializations of this hash
should be backward. For some reason Satoshi decided this should be
true for
Sha256dHash
, so here we are.§fn from_engine(e: HashEngine) -> Hash<T>
fn from_engine(e: HashEngine) -> Hash<T>
Produces a hash from the current state of a given engine.
§fn to_byte_array(self) -> <Hash<T> as Hash>::Bytes
fn to_byte_array(self) -> <Hash<T> as Hash>::Bytes
Returns the underlying byte array.
§fn as_byte_array(&self) -> &<Hash<T> as Hash>::Bytes
fn as_byte_array(&self) -> &<Hash<T> as Hash>::Bytes
Returns a reference to the underlying byte array.
§impl<T> Ord for Hash<T>where
T: Tag,
impl<T> Ord for Hash<T>where T: Tag,
§impl<T> PartialOrd<Hash<T>> for Hash<T>where
T: Tag,
impl<T> PartialOrd<Hash<T>> for Hash<T>where T: Tag,
§fn partial_cmp(&self, other: &Hash<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Hash<T>) -> 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<T> SerdeHash for Hash<T>where
T: Tag,
impl<T> SerdeHash for Hash<T>where T: Tag,
§fn from_slice_delegated(sl: &[u8]) -> Result<Hash<T>, Error>
fn from_slice_delegated(sl: &[u8]) -> Result<Hash<T>, 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<T> Serialize for Hash<T>where
T: Tag,
impl<T> Serialize for Hash<T>where T: Tag,
§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<T> ThirtyTwoByteHash for Hash<T>where
T: Tag,
impl<T> ThirtyTwoByteHash for Hash<T>where T: Tag,
impl<T> Copy for Hash<T>where T: Tag,
impl<T> Eq for Hash<T>where T: Tag,
Auto Trait Implementations§
impl<T> RefUnwindSafe for Hash<T>where T: RefUnwindSafe,
impl<T> Send for Hash<T>where T: Send,
impl<T> Sync for Hash<T>where T: Sync,
impl<T> Unpin for Hash<T>where T: Unpin,
impl<T> UnwindSafe for Hash<T>where T: UnwindSafe,
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.