#[repr(transparent)]pub struct Hash(_);Expand description
Output of the SHA256d hash function.
Implementations§
§impl Hash
impl Hash
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> Deserialize<'de> for Hash
impl<'de> Deserialize<'de> for Hash
§fn deserialize<D>(d: D) -> Result<Hash, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Hash, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl From<FilterHash> for Hash
impl From<FilterHash> for Hash
§fn from(hashtype: FilterHash) -> Hash
fn from(hashtype: FilterHash) -> Hash
Converts to this type from the input type.
§impl From<FilterHeader> for Hash
impl From<FilterHeader> for Hash
§fn from(hashtype: FilterHeader) -> Hash
fn from(hashtype: FilterHeader) -> Hash
Converts to this type from the input type.
§impl From<Hash> for FilterHash
impl From<Hash> for FilterHash
§fn from(inner: Hash) -> FilterHash
fn from(inner: Hash) -> FilterHash
Converts to this type from the input type.
§impl From<Hash> for FilterHeader
impl From<Hash> for FilterHeader
§fn from(inner: Hash) -> FilterHeader
fn from(inner: Hash) -> FilterHeader
Converts to this type from the input type.
§impl From<Hash> for LegacySighash
impl From<Hash> for LegacySighash
§fn from(inner: Hash) -> LegacySighash
fn from(inner: Hash) -> LegacySighash
Converts to this type from the input type.
§impl From<Hash> for SegwitV0Sighash
impl From<Hash> for SegwitV0Sighash
§fn from(inner: Hash) -> SegwitV0Sighash
fn from(inner: Hash) -> SegwitV0Sighash
Converts to this type from the input type.
§impl From<Hash> for TxMerkleNode
impl From<Hash> for TxMerkleNode
§fn from(inner: Hash) -> TxMerkleNode
fn from(inner: Hash) -> TxMerkleNode
Converts to this type from the input type.
§impl From<Hash> for WitnessCommitment
impl From<Hash> for WitnessCommitment
§fn from(inner: Hash) -> WitnessCommitment
fn from(inner: Hash) -> WitnessCommitment
Converts to this type from the input type.
§impl From<Hash> for WitnessMerkleNode
impl From<Hash> for WitnessMerkleNode
§fn from(inner: Hash) -> WitnessMerkleNode
fn from(inner: Hash) -> WitnessMerkleNode
Converts to this type from the input type.
§impl From<LegacySighash> for Hash
impl From<LegacySighash> for Hash
§fn from(hashtype: LegacySighash) -> Hash
fn from(hashtype: LegacySighash) -> Hash
Converts to this type from the input type.
§impl From<SegwitV0Sighash> for Hash
impl From<SegwitV0Sighash> for Hash
§fn from(hashtype: SegwitV0Sighash) -> Hash
fn from(hashtype: SegwitV0Sighash) -> Hash
Converts to this type from the input type.
§impl From<TxMerkleNode> for Hash
impl From<TxMerkleNode> for Hash
§fn from(hashtype: TxMerkleNode) -> Hash
fn from(hashtype: TxMerkleNode) -> Hash
Converts to this type from the input type.
§impl From<WitnessCommitment> for Hash
impl From<WitnessCommitment> for Hash
§fn from(hashtype: WitnessCommitment) -> Hash
fn from(hashtype: WitnessCommitment) -> Hash
Converts to this type from the input type.
§impl From<WitnessMerkleNode> for Hash
impl From<WitnessMerkleNode> for Hash
§fn from(hashtype: WitnessMerkleNode) -> Hash
fn from(hashtype: WitnessMerkleNode) -> Hash
Converts to this type from the input type.
§impl Hash for Hash
impl Hash for Hash
§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
fn from_engine(e: HashEngine) -> Hash
Produces a hash from the current state of a given engine.
§fn to_byte_array(self) -> <Hash as Hash>::Bytes
fn to_byte_array(self) -> <Hash as Hash>::Bytes
Returns the underlying byte array.
§fn as_byte_array(&self) -> &<Hash as Hash>::Bytes
fn as_byte_array(&self) -> &<Hash as Hash>::Bytes
Returns a reference to the underlying byte array.
§impl<I> Index<I> for Hashwhere
I: SliceIndex<[u8]>,
impl<I> Index<I> for Hashwhere I: SliceIndex<[u8]>,
§impl Ord for Hash
impl Ord for Hash
§impl PartialOrd<Hash> for Hash
impl PartialOrd<Hash> for Hash
§fn partial_cmp(&self, other: &Hash) -> Option<Ordering>
fn partial_cmp(&self, other: &Hash) -> 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 Hash
impl SerdeHash for Hash
§fn from_slice_delegated(sl: &[u8]) -> Result<Hash, Error>
fn from_slice_delegated(sl: &[u8]) -> Result<Hash, 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 Hash
impl Serialize for Hash
§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 ThirtyTwoByteHash for Hash
impl ThirtyTwoByteHash for Hash
impl Copy for Hash
impl Eq for Hash
impl StructuralEq for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
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.