pub struct WScriptHash(/* private fields */);Expand description
SegWit (256-bit) version of a Tidecoin script bytecode hash.
Implementations§
Source§impl WScriptHash
impl WScriptHash
Sourcepub fn from_script(
witness_script: &WitnessScript,
) -> Result<Self, WitnessScriptSizeError>
pub fn from_script( witness_script: &WitnessScript, ) -> Result<Self, WitnessScriptSizeError>
Constructs a new WScriptHash after first checking the script size.
§10,000-byte limit on the witness script
The witnessScript (≤ 10,000 bytes) is popped off the initial witness stack. SHA256 of the witnessScript must match the 32-byte witness program.
§Errors
Returns an error if the script exceeds 10,000 bytes.
Sourcepub fn from_script_unchecked(script: &WitnessScript) -> Self
pub fn from_script_unchecked(script: &WitnessScript) -> Self
Constructs a new WScriptHash from any script irrespective of script size.
If you hash a script that exceeds 10,000 bytes in size and use it to create a Segwit output then the output will be unspendable.
§impl WScriptHash
impl WScriptHash
pub const fn from_byte_array(bytes: [u8; 32]) -> Self
pub const fn from_byte_array(bytes: [u8; 32]) -> Self
Constructs a new type from the underlying byte array.
pub const fn to_byte_array(self) -> [u8; 32]
pub const fn to_byte_array(self) -> [u8; 32]
Returns the underlying byte array.
pub const fn as_byte_array(&self) -> &[u8; 32]
pub const fn as_byte_array(&self) -> &[u8; 32]
Returns a reference to the underlying byte array.
Trait Implementations§
§impl<'a> Arbitrary<'a> for WScriptHash
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for WScriptHash
Available on crate feature
arbitrary only.§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read more§impl AsRef<[u8; 32]> for WScriptHash
impl AsRef<[u8; 32]> for WScriptHash
§impl AsRef<[u8]> for WScriptHash
impl AsRef<[u8]> for WScriptHash
§impl Borrow<[u8; 32]> for WScriptHash
impl Borrow<[u8; 32]> for WScriptHash
§impl Borrow<[u8]> for WScriptHash
impl Borrow<[u8]> for WScriptHash
Source§impl Clone for WScriptHash
impl Clone for WScriptHash
Source§fn clone(&self) -> WScriptHash
fn clone(&self) -> WScriptHash
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for WScriptHash
Source§impl Debug for WScriptHash
impl Debug for WScriptHash
§impl<'de> Deserialize<'de> for WScriptHash
impl<'de> Deserialize<'de> for WScriptHash
§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<WScriptHash, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<WScriptHash, D::Error>
Deserialize this value from the given Serde deserializer. Read more
§impl Display for WScriptHash
Available on crate feature hex only.
impl Display for WScriptHash
Available on crate feature
hex only.impl Eq for WScriptHash
§impl FromStr for WScriptHash
Available on crate feature hex only.
impl FromStr for WScriptHash
Available on crate feature
hex only.Source§impl Hash for WScriptHash
impl Hash for WScriptHash
§impl LowerHex for WScriptHash
Available on crate feature hex only.
impl LowerHex for WScriptHash
Available on crate feature
hex only.Source§impl Ord for WScriptHash
impl Ord for WScriptHash
Source§fn cmp(&self, other: &WScriptHash) -> Ordering
fn cmp(&self, other: &WScriptHash) -> Ordering
1.21.0 (const: unstable) · 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 for WScriptHash
impl PartialEq for WScriptHash
Source§impl PartialOrd for WScriptHash
impl PartialOrd for WScriptHash
§impl Serialize for WScriptHash
impl Serialize for WScriptHash
impl StructuralPartialEq for WScriptHash
Source§impl TryFrom<&Script<WitnessScriptTag>> for WScriptHash
impl TryFrom<&Script<WitnessScriptTag>> for WScriptHash
Source§type Error = WitnessScriptSizeError
type Error = WitnessScriptSizeError
The type returned in the event of a conversion error.
Source§impl TryFrom<&ScriptBuf<WitnessScriptTag>> for WScriptHash
impl TryFrom<&ScriptBuf<WitnessScriptTag>> for WScriptHash
Source§type Error = WitnessScriptSizeError
type Error = WitnessScriptSizeError
The type returned in the event of a conversion error.
Source§impl TryFrom<ScriptBuf<WitnessScriptTag>> for WScriptHash
impl TryFrom<ScriptBuf<WitnessScriptTag>> for WScriptHash
Source§type Error = WitnessScriptSizeError
type Error = WitnessScriptSizeError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for WScriptHash
impl RefUnwindSafe for WScriptHash
impl Send for WScriptHash
impl Sync for WScriptHash
impl Unpin for WScriptHash
impl UnsafeUnpin for WScriptHash
impl UnwindSafe for WScriptHash
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