Struct Hash
pub struct Hash<T>(/* private fields */)
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,
§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.§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.§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 for Hash<T>where
T: Tag,
impl<T> PartialOrd for Hash<T>where
T: Tag,
§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> Freeze for Hash<T>
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> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<T> Base32Len for T
impl<T> Base32Len for T
§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
§impl<T> CheckBase32<Vec<u5>> for T
impl<T> CheckBase32<Vec<u5>> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToBase32 for T
impl<T> ToBase32 for T
§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.
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.