Struct bitcoin::TapLeafHash
source · pub struct TapLeafHash(/* private fields */);
Expand description
Taproot-tagged hash with tag "TapLeaf".
This is used for computing tapscript script spend hash.
Implementations§
source§impl TapLeafHash
impl TapLeafHash
sourcepub fn from_raw_hash(inner: Hash<TapLeafTag>) -> TapLeafHash
pub fn from_raw_hash(inner: Hash<TapLeafTag>) -> TapLeafHash
Creates this wrapper type from the inner hash type.
sourcepub fn to_raw_hash(self) -> Hash<TapLeafTag>
pub fn to_raw_hash(self) -> Hash<TapLeafTag>
Returns the inner hash (sha256, sh256d etc.).
sourcepub fn as_raw_hash(&self) -> &Hash<TapLeafTag>
pub fn as_raw_hash(&self) -> &Hash<TapLeafTag>
Returns a reference to the inner hash (sha256, sh256d etc.).
source§impl TapLeafHash
impl TapLeafHash
sourcepub fn from_script(script: &Script, ver: LeafVersion) -> TapLeafHash
pub fn from_script(script: &Script, ver: LeafVersion) -> TapLeafHash
Computes the leaf hash from components.
Trait Implementations§
source§impl AsRef<[u8]> for TapLeafHash
impl AsRef<[u8]> for TapLeafHash
source§impl Borrow<[u8]> for TapLeafHash
impl Borrow<[u8]> for TapLeafHash
source§impl Clone for TapLeafHash
impl Clone for TapLeafHash
source§fn clone(&self) -> TapLeafHash
fn clone(&self) -> TapLeafHash
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TapLeafHash
impl Debug for TapLeafHash
source§impl Decodable for TapLeafHash
impl Decodable for TapLeafHash
source§impl<'de> Deserialize<'de> for TapLeafHash
impl<'de> Deserialize<'de> for TapLeafHash
source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<TapLeafHash, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<TapLeafHash, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for TapLeafHash
impl Display for TapLeafHash
source§impl Encodable for TapLeafHash
impl Encodable for TapLeafHash
source§impl From<Hash<TapLeafTag>> for TapLeafHash
impl From<Hash<TapLeafTag>> for TapLeafHash
source§fn from(inner: Hash<TapLeafTag>) -> TapLeafHash
fn from(inner: Hash<TapLeafTag>) -> TapLeafHash
Converts to this type from the input type.
source§impl<'s> From<ScriptPath<'s>> for TapLeafHash
impl<'s> From<ScriptPath<'s>> for TapLeafHash
source§fn from(script_path: ScriptPath<'s>) -> TapLeafHash
fn from(script_path: ScriptPath<'s>) -> TapLeafHash
Converts to this type from the input type.
source§impl From<TapLeafHash> for Hash<TapLeafTag>
impl From<TapLeafHash> for Hash<TapLeafTag>
source§fn from(hashtype: TapLeafHash) -> Hash<TapLeafTag>
fn from(hashtype: TapLeafHash) -> Hash<TapLeafTag>
Converts to this type from the input type.
source§impl From<TapLeafHash> for TapNodeHash
impl From<TapLeafHash> for TapNodeHash
source§fn from(leaf: TapLeafHash) -> TapNodeHash
fn from(leaf: TapLeafHash) -> TapNodeHash
Converts to this type from the input type.
source§impl FromStr for TapLeafHash
impl FromStr for TapLeafHash
source§impl Hash for TapLeafHash
impl Hash for TapLeafHash
source§impl Hash for TapLeafHash
impl Hash for TapLeafHash
§type Engine = <Hash<TapLeafTag> as Hash>::Engine
type Engine = <Hash<TapLeafTag> as Hash>::Engine
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.source§const DISPLAY_BACKWARD: bool = false
const DISPLAY_BACKWARD: bool = false
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.source§fn from_engine(e: Self::Engine) -> Self
fn from_engine(e: Self::Engine) -> Self
Produces a hash from the current state of a given engine.
source§fn from_slice(sl: &[u8]) -> Result<TapLeafHash, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<TapLeafHash, FromSliceError>
Copies a byte slice into a hash object.
source§fn from_byte_array(bytes: Self::Bytes) -> Self
fn from_byte_array(bytes: Self::Bytes) -> Self
Constructs a hash from the underlying byte array.
source§fn to_byte_array(self) -> Self::Bytes
fn to_byte_array(self) -> Self::Bytes
Returns the underlying byte array.
source§fn as_byte_array(&self) -> &Self::Bytes
fn as_byte_array(&self) -> &Self::Bytes
Returns a reference to the underlying byte array.
source§fn hash_byte_chunks<B, I>(byte_slices: I) -> Selfwhere
B: AsRef<[u8]>,
I: IntoIterator<Item = B>,
fn hash_byte_chunks<B, I>(byte_slices: I) -> Selfwhere B: AsRef<[u8]>, I: IntoIterator<Item = B>,
Hashes all the byte slices retrieved from the iterator together.
source§impl<I: SliceIndex<[u8]>> Index<I> for TapLeafHash
impl<I: SliceIndex<[u8]>> Index<I> for TapLeafHash
source§impl LowerHex for TapLeafHash
impl LowerHex for TapLeafHash
source§impl Ord for TapLeafHash
impl Ord for TapLeafHash
source§fn cmp(&self, other: &TapLeafHash) -> Ordering
fn cmp(&self, other: &TapLeafHash) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<TapLeafHash> for TapLeafHash
impl PartialEq<TapLeafHash> for TapLeafHash
source§fn eq(&self, other: &TapLeafHash) -> bool
fn eq(&self, other: &TapLeafHash) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<TapLeafHash> for TapLeafHash
impl PartialOrd<TapLeafHash> for TapLeafHash
source§fn partial_cmp(&self, other: &TapLeafHash) -> Option<Ordering>
fn partial_cmp(&self, other: &TapLeafHash) -> 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 moresource§impl SerdeHash for TapLeafHash
impl SerdeHash for TapLeafHash
source§fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>
fn from_slice_delegated(sl: &[u8]) -> Result<Self, FromSliceError>
Helper function to turn a deserialized slice into the correct hash type.
source§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.
source§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.
source§impl Serialize for TapLeafHash
impl Serialize for TapLeafHash
source§impl UpperHex for TapLeafHash
impl UpperHex for TapLeafHash
impl Copy for TapLeafHash
impl Eq for TapLeafHash
impl StructuralEq for TapLeafHash
impl StructuralPartialEq for TapLeafHash
Auto Trait Implementations§
impl RefUnwindSafe for TapLeafHash
impl Send for TapLeafHash
impl Sync for TapLeafHash
impl Unpin for TapLeafHash
impl UnwindSafe for TapLeafHash
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