[][src]Struct bitcoin_rpc_client::Script

pub struct Script(_);

A Bitcoin script

Methods

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 p2pkh output

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 iter(&self, enforce_minimal: bool) -> Instructions[src]

Iterate over the script in the form of Instructions, 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<(), Error>[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 Hash for Script[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialOrd<Script> for Script[src]

impl Serialize for Script[src]

impl<S> Encodable<S> for Script where
    S: Encoder
[src]

impl Eq for Script[src]

impl<D> Decodable<D> for Script where
    D: Decoder
[src]

impl Default for Script[src]

impl<'de> Deserialize<'de> for Script[src]

impl Clone for Script[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Script> for Script[src]

impl Index<RangeTo<usize>> for Script[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFrom<usize>> for Script[src]

type Output = [u8]

The returned type after indexing.

impl Index<RangeFull> for Script[src]

type Output = [u8]

The returned type after indexing.

impl Index<Range<usize>> for Script[src]

type Output = [u8]

The returned type after indexing.

impl Deserialize for Script[src]

impl Debug for Script[src]

impl Display for Script[src]

impl LowerHex for Script[src]

impl UpperHex for Script[src]

impl Ord for Script[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl From<Vec<u8>> for Script[src]

Creates a new script from an existing vector

impl Serialize for Script[src]

fn serialize<S>(
    &self,
    serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
    S: Serializer
[src]

User-facing serialization for Script.

Auto Trait Implementations

impl Send for Script

impl Sync for Script

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> ToHex for T where
    T: LowerHex
[src]

fn to_hex(&self) -> String[src]

Outputs the hash in hexadecimal form

impl<T> Configure for T where
    T: ?Sized
[src]

fn readable(self) -> Readable<Self>[src]

Marks self as using is_human_readable == true

fn compact(self) -> Compact<Self>[src]

Marks self as using is_human_readable == false

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err