Struct bitcoin::script::ScriptHash
source · pub struct ScriptHash(/* private fields */);
Expand description
A hash of Bitcoin Script bytecode.
Implementations§
source§impl ScriptHash
impl ScriptHash
sourcepub fn from_raw_hash(inner: Hash) -> ScriptHash
pub fn from_raw_hash(inner: Hash) -> ScriptHash
Creates this wrapper type from the inner hash type.
sourcepub fn to_raw_hash(self) -> Hash
pub fn to_raw_hash(self) -> Hash
Returns the inner hash (sha256, sh256d etc.).
sourcepub fn as_raw_hash(&self) -> &Hash
pub fn as_raw_hash(&self) -> &Hash
Returns a reference to the inner hash (sha256, sh256d etc.).
Trait Implementations§
source§impl AsRef<[u8]> for ScriptHash
impl AsRef<[u8]> for ScriptHash
source§impl AsRef<PushBytes> for ScriptHash
impl AsRef<PushBytes> for ScriptHash
source§impl Borrow<[u8]> for ScriptHash
impl Borrow<[u8]> for ScriptHash
source§impl Clone for ScriptHash
impl Clone for ScriptHash
source§fn clone(&self) -> ScriptHash
fn clone(&self) -> ScriptHash
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 ScriptHash
impl Debug for ScriptHash
source§impl<'de> Deserialize<'de> for ScriptHash
impl<'de> Deserialize<'de> for ScriptHash
source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<ScriptHash, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<ScriptHash, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for ScriptHash
impl Display for ScriptHash
source§impl From<&Script> for ScriptHash
impl From<&Script> for ScriptHash
source§fn from(script: &Script) -> ScriptHash
fn from(script: &Script) -> ScriptHash
Converts to this type from the input type.
source§impl From<&ScriptBuf> for ScriptHash
impl From<&ScriptBuf> for ScriptHash
source§fn from(script: &ScriptBuf) -> ScriptHash
fn from(script: &ScriptBuf) -> ScriptHash
Converts to this type from the input type.
source§impl From<Hash> for ScriptHash
impl From<Hash> for ScriptHash
source§fn from(inner: Hash) -> ScriptHash
fn from(inner: Hash) -> ScriptHash
Converts to this type from the input type.
source§impl From<ScriptBuf> for ScriptHash
impl From<ScriptBuf> for ScriptHash
source§fn from(script: ScriptBuf) -> ScriptHash
fn from(script: ScriptBuf) -> ScriptHash
Converts to this type from the input type.
source§impl From<ScriptHash> for Hash
impl From<ScriptHash> for Hash
source§fn from(hashtype: ScriptHash) -> Hash
fn from(hashtype: ScriptHash) -> Hash
Converts to this type from the input type.
source§impl From<ScriptHash> for PushBytesBuf
impl From<ScriptHash> for PushBytesBuf
source§fn from(hash: ScriptHash) -> Self
fn from(hash: ScriptHash) -> Self
Converts to this type from the input type.
source§impl FromStr for ScriptHash
impl FromStr for ScriptHash
source§impl Hash for ScriptHash
impl Hash for ScriptHash
source§impl Hash for ScriptHash
impl Hash for ScriptHash
§type Engine = <Hash as Hash>::Engine
type Engine = <Hash 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<ScriptHash, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<ScriptHash, 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 ScriptHash
impl<I: SliceIndex<[u8]>> Index<I> for ScriptHash
source§impl LowerHex for ScriptHash
impl LowerHex for ScriptHash
source§impl Ord for ScriptHash
impl Ord for ScriptHash
source§fn cmp(&self, other: &ScriptHash) -> Ordering
fn cmp(&self, other: &ScriptHash) -> 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<ScriptHash> for ScriptHash
impl PartialEq<ScriptHash> for ScriptHash
source§fn eq(&self, other: &ScriptHash) -> bool
fn eq(&self, other: &ScriptHash) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<ScriptHash> for ScriptHash
impl PartialOrd<ScriptHash> for ScriptHash
source§fn partial_cmp(&self, other: &ScriptHash) -> Option<Ordering>
fn partial_cmp(&self, other: &ScriptHash) -> 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 ScriptHash
impl SerdeHash for ScriptHash
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 ScriptHash
impl Serialize for ScriptHash
source§impl UpperHex for ScriptHash
impl UpperHex for ScriptHash
impl Copy for ScriptHash
impl Eq for ScriptHash
impl StructuralEq for ScriptHash
impl StructuralPartialEq for ScriptHash
Auto Trait Implementations§
impl RefUnwindSafe for ScriptHash
impl Send for ScriptHash
impl Sync for ScriptHash
impl Unpin for ScriptHash
impl UnwindSafe for ScriptHash
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