[−][src]Struct tapyrus::blockdata::script::Script
A Bitcoin script
Implementations
impl Script
[src]
pub fn new() -> Script
[src]
Creates a new empty script
pub fn len(&self) -> usize
[src]
The length in bytes of the script
pub fn is_empty(&self) -> bool
[src]
Whether the script is the empty script
pub fn as_bytes(&self) -> &[u8]ⓘ
[src]
Returns the script data
pub fn to_bytes(&self) -> Vec<u8>
[src]
Returns a copy of the script data
pub fn into_bytes(self) -> Vec<u8>
[src]
Convert the script into a byte vector
pub fn to_p2sh(&self) -> Script
[src]
Compute the P2SH output corresponding to this redeem script
pub fn to_v0_p2wsh(&self) -> Script
[src]
Compute the P2WSH output corresponding to this witnessScript (aka the "witness redeem script")
pub fn is_p2sh(&self) -> bool
[src]
Checks whether a script pubkey is a p2sh output
pub fn is_p2pkh(&self) -> bool
[src]
Checks whether a script pubkey is a p2pkh output
pub fn is_p2pk(&self) -> bool
[src]
Checks whether a script pubkey is a p2pk output
pub fn is_witness_program(&self) -> bool
[src]
Checks whether a script pubkey is a Segregated Witness (segwit) program.
pub fn is_v0_p2wsh(&self) -> bool
[src]
Checks whether a script pubkey is a p2wsh output
pub fn is_v0_p2wpkh(&self) -> bool
[src]
Checks whether a script pubkey is a p2wpkh output
pub fn is_op_return(&self) -> bool
[src]
Check if this is an OP_RETURN output
pub fn is_provably_unspendable(&self) -> bool
[src]
Whether a script can be proven to have no satisfying input
pub fn is_cp2pkh(&self) -> bool
[src]
Check if a script pubkey is a cp2pkh output
pub fn is_cp2sh(&self) -> bool
[src]
Check if a script pubkey is a cp2sh output
pub fn is_colored(&self) -> bool
[src]
Check if a script pubkey is a colored coin script
pub fn add_color(
&self,
color_id: ColorIdentifier
) -> Result<Script, ColoredCoinError>
[src]
&self,
color_id: ColorIdentifier
) -> Result<Script, ColoredCoinError>
Create new script with color identifier
pub fn iter(&self, enforce_minimal: bool) -> Instructions<'_>ⓘNotable traits for Instructions<'a>
impl<'a> Iterator for Instructions<'a> type Item = Instruction<'a>;
[src]
Notable traits for Instructions<'a>
impl<'a> Iterator for Instructions<'a> type Item = Instruction<'a>;
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()
.
pub fn fmt_asm(&self, f: &mut dyn Write) -> Result
[src]
Write the assembly decoding of the script to the formatter.
pub fn asm(&self) -> String
[src]
Get the assembly decoding of the script.
Trait Implementations
impl Clone for Script
[src]
impl Debug for Script
[src]
impl Decodable for Script
[src]
pub fn consensus_decode<D: Read>(d: D) -> Result<Self, Error>
[src]
impl Default for Script
[src]
impl Deserialize for Script
[src]
impl Display for Script
[src]
impl Encodable for Script
[src]
impl Eq for Script
[src]
impl From<Vec<u8, Global>> for Script
[src]
Creates a new script from an existing vector
impl Hash for Script
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Index<Range<usize>> for Script
[src]
type Output = [u8]
The returned type after indexing.
pub fn index(&self, index: Range<usize>) -> &[u8]ⓘ
[src]
impl Index<RangeFrom<usize>> for Script
[src]
type Output = [u8]
The returned type after indexing.
pub fn index(&self, index: RangeFrom<usize>) -> &[u8]ⓘ
[src]
impl Index<RangeFull> for Script
[src]
type Output = [u8]
The returned type after indexing.
pub fn index(&self, _: RangeFull) -> &[u8]ⓘ
[src]
impl Index<RangeTo<usize>> for Script
[src]
type Output = [u8]
The returned type after indexing.
pub fn index(&self, index: RangeTo<usize>) -> &[u8]ⓘ
[src]
impl LowerHex for Script
[src]
impl Ord for Script
[src]
pub fn cmp(&self, other: &Script) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Script> for Script
[src]
impl PartialOrd<Script> for Script
[src]
pub fn partial_cmp(&self, other: &Script) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Script) -> bool
[src]
pub fn le(&self, other: &Script) -> bool
[src]
pub fn gt(&self, other: &Script) -> bool
[src]
pub fn ge(&self, other: &Script) -> bool
[src]
impl Serialize for Script
[src]
impl StructuralEq for Script
[src]
impl StructuralPartialEq for Script
[src]
impl UpperHex for Script
[src]
Auto Trait Implementations
impl RefUnwindSafe for Script
[src]
impl Send for Script
[src]
impl Sync for Script
[src]
impl Unpin for Script
[src]
impl UnwindSafe for Script
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Az for T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedAs for T
[src]
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
T: CheckedCast<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> OverflowingAs for T
[src]
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
T: OverflowingCast<Dst>,
impl<T> SaturatingAs for T
[src]
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
T: SaturatingCast<Dst>,
impl<T> ToHex for T where
T: LowerHex,
[src]
T: LowerHex,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WrappingAs for T
[src]
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
T: WrappingCast<Dst>,