Struct bitcoin::blockdata::script::Script [−][src]
pub struct Script(_);
A Bitcoin script
Methods
impl Script
[src]
impl Script
pub fn new() -> Script
[src]
pub fn new() -> Script
Creates a new empty script
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
The length in bytes of the script
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Whether the script is the empty script
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
Returns the script data
pub fn to_bytes(&self) -> Vec<u8>
[src]
pub fn to_bytes(&self) -> Vec<u8>
Returns a copy of the script data
pub fn into_bytes(self) -> Vec<u8>
[src]
pub fn into_bytes(self) -> Vec<u8>
Convert the script into a byte vector
pub fn to_p2sh(&self) -> Script
[src]
pub fn to_p2sh(&self) -> Script
Compute the P2SH output corresponding to this redeem script
pub fn to_v0_p2wsh(&self) -> Script
[src]
pub fn to_v0_p2wsh(&self) -> Script
Compute the P2WSH output corresponding to this witnessScript (aka the "witness redeem script")
pub fn is_p2sh(&self) -> bool
[src]
pub fn is_p2sh(&self) -> bool
Checks whether a script pubkey is a p2sh output
pub fn is_p2pkh(&self) -> bool
[src]
pub fn is_p2pkh(&self) -> bool
Checks whether a script pubkey is a p2pkh output
pub fn is_p2pk(&self) -> bool
[src]
pub fn is_p2pk(&self) -> bool
Checks whether a script pubkey is a p2pkh output
pub fn is_v0_p2wsh(&self) -> bool
[src]
pub fn is_v0_p2wsh(&self) -> bool
Checks whether a script pubkey is a p2wsh output
pub fn is_v0_p2wpkh(&self) -> bool
[src]
pub fn is_v0_p2wpkh(&self) -> bool
Checks whether a script pubkey is a p2wpkh output
pub fn is_op_return(&self) -> bool
[src]
pub fn is_op_return(&self) -> bool
Check if this is an OP_RETURN output
pub fn is_provably_unspendable(&self) -> bool
[src]
pub fn is_provably_unspendable(&self) -> bool
Whether a script can be proven to have no satisfying input
ⓘImportant traits for Instructions<'a>pub fn iter(&self, enforce_minimal: bool) -> Instructions
[src]
pub fn iter(&self, enforce_minimal: bool) -> Instructions
Iterate over the script in the form of Instruction
s, which are an enum covering
opcodes, datapushes and errors. At most one error will be returned and then the
iterator will end. To instead iterate over the script as sequence of bytes, treat
it as a slice using script[..]
or convert it to a vector using into_bytes()
.
Trait Implementations
impl Clone for Script
[src]
impl Clone for Script
fn clone(&self) -> Script
[src]
fn clone(&self) -> Script
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for Script
[src]
impl Default for Script
impl PartialOrd for Script
[src]
impl PartialOrd for Script
fn partial_cmp(&self, other: &Script) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Script) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Script) -> bool
[src]
fn lt(&self, other: &Script) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Script) -> bool
[src]
fn le(&self, other: &Script) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Script) -> bool
[src]
fn gt(&self, other: &Script) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Script) -> bool
[src]
fn ge(&self, other: &Script) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for Script
[src]
impl Ord for Script
fn cmp(&self, other: &Script) -> Ordering
[src]
fn cmp(&self, other: &Script) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialEq for Script
[src]
impl PartialEq for Script
fn eq(&self, other: &Script) -> bool
[src]
fn eq(&self, other: &Script) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Script) -> bool
[src]
fn ne(&self, other: &Script) -> bool
This method tests for !=
.
impl Eq for Script
[src]
impl Eq for Script
impl Hash for Script
[src]
impl Hash for Script
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Script
[src]
impl Debug for Script
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Script
[src]
impl Display for Script
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl LowerHex for Script
[src]
impl LowerHex for Script
impl UpperHex for Script
[src]
impl UpperHex for Script
impl From<Vec<u8>> for Script
[src]
impl From<Vec<u8>> for Script
Creates a new script from an existing vector
impl Index<Range<usize>> for Script
[src]
impl Index<Range<usize>> for Script
type Output = [u8]
The returned type after indexing.
fn index(&self, index: Range<usize>) -> &[u8]
[src]
fn index(&self, index: Range<usize>) -> &[u8]
Performs the indexing (container[index]
) operation.
impl Index<RangeTo<usize>> for Script
[src]
impl Index<RangeTo<usize>> for Script
type Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeTo<usize>) -> &[u8]
[src]
fn index(&self, index: RangeTo<usize>) -> &[u8]
Performs the indexing (container[index]
) operation.
impl Index<RangeFrom<usize>> for Script
[src]
impl Index<RangeFrom<usize>> for Script
type Output = [u8]
The returned type after indexing.
fn index(&self, index: RangeFrom<usize>) -> &[u8]
[src]
fn index(&self, index: RangeFrom<usize>) -> &[u8]
Performs the indexing (container[index]
) operation.
impl Index<RangeFull> for Script
[src]
impl Index<RangeFull> for Script
type Output = [u8]
The returned type after indexing.
fn index(&self, _: RangeFull) -> &[u8]
[src]
fn index(&self, _: RangeFull) -> &[u8]
Performs the indexing (container[index]
) operation.
impl<S: SimpleEncoder> ConsensusEncodable<S> for Script
[src]
impl<S: SimpleEncoder> ConsensusEncodable<S> for Script
fn consensus_encode(&self, s: &mut S) -> Result<(), Error>
[src]
fn consensus_encode(&self, s: &mut S) -> Result<(), Error>
Encode an object with a well-defined format
impl<D: SimpleDecoder> ConsensusDecodable<D> for Script
[src]
impl<D: SimpleDecoder> ConsensusDecodable<D> for Script