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 from_bytes_ref(bytes: &[u8; 32]) -> &Hash<T>
pub fn from_bytes_ref(bytes: &[u8; 32]) -> &Hash<T>
Zero cost conversion between a fixed length byte array shared reference and a shared reference to this Hash type.
pub fn from_bytes_mut(bytes: &mut [u8; 32]) -> &mut Hash<T>
pub fn from_bytes_mut(bytes: &mut [u8; 32]) -> &mut Hash<T>
Zero cost conversion between a fixed length byte array exclusive reference and an exclusive reference to this Hash type.
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 from_slice(sl: &[u8]) -> Result<Hash<T>, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<Hash<T>, FromSliceError>
Copies a byte slice into a hash object.
§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.
§fn from_byte_array(bytes: <Hash<T> as Hash>::Bytes) -> Hash<T>
fn from_byte_array(bytes: <Hash<T> as Hash>::Bytes) -> Hash<T>
Constructs a hash from the underlying byte array.
§fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
Hashes all the byte slices retrieved from the iterator together.
§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>, FromSliceError>
fn from_slice_delegated(sl: &[u8]) -> Result<Hash<T>, FromSliceError>
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> 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§
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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