[][src]Enum miniscript::miniscript::astelem::AstElem

pub enum AstElem<P> {
    True,
    Pk(P),
    PkV(P),
    PkQ(P),
    PkW(P),
    Multi(usizeVec<P>),
    MultiV(usizeVec<P>),
    Time(u32),
    TimeV(u32),
    TimeF(u32),
    TimeE(u32),
    TimeW(u32),
    Hash(Hash),
    HashV(Hash),
    HashW(Hash),
    Wrap(Box<AstElem<P>>),
    Likely(Box<AstElem<P>>),
    Unlikely(Box<AstElem<P>>),
    AndCat(Box<AstElem<P>>, Box<AstElem<P>>),
    AndBool(Box<AstElem<P>>, Box<AstElem<P>>),
    AndCasc(Box<AstElem<P>>, Box<AstElem<P>>),
    OrBool(Box<AstElem<P>>, Box<AstElem<P>>),
    OrCasc(Box<AstElem<P>>, Box<AstElem<P>>),
    OrCont(Box<AstElem<P>>, Box<AstElem<P>>),
    OrKey(Box<AstElem<P>>, Box<AstElem<P>>),
    OrKeyV(Box<AstElem<P>>, Box<AstElem<P>>),
    OrIf(Box<AstElem<P>>, Box<AstElem<P>>),
    OrIfV(Box<AstElem<P>>, Box<AstElem<P>>),
    OrNotif(Box<AstElem<P>>, Box<AstElem<P>>),
    Thresh(usizeVec<AstElem<P>>),
    ThreshV(usizeVec<AstElem<P>>),
}

All AST elements

Variants

True

1

Pk(P)

<key> CHECKSIG

PkV(P)

<key> CHECKSIGVERIFY

PkQ(P)

<key>

PkW(P)

SWAP <key> CHECKSIG

Multi(usizeVec<P>)

<k> <keys...> <n> CHECKMULTISIG

MultiV(usizeVec<P>)

<k> <keys...> <n> CHECKMULTISIGVERIFY

Time(u32)

<n> CHECKSEQUENCEVERIFY

TimeV(u32)

<n> CHECKSEQUENCEVERIFY DROP

TimeF(u32)

<n> CHECKSEQUENCEVERIFY 0NOTEQUAL

TimeE(u32)

DUP IF <n> CHECKSEQUENCEVERIFY DROP ENDIF

TimeW(u32)

SWAP DUP IF <n> CHECKSEQUENCEVERIFY DROP ENDIF

Hash(Hash)

SIZE 32 EQUALVERIFY SHA256 <hash> EQUAL

HashV(Hash)

SIZE 32 EQUALVERIFY SHA256 <hash> EQUALVERIFY

HashW(Hash)

SWAP SIZE 0NOTEQUAL IF SIZE 32 EQUALVERIFY SHA256 <hash> EQUALVERIFY 1 ENDIF

Wrap(Box<AstElem<P>>)

TAS <E> FAS

Likely(Box<AstElem<P>>)

NOTIF <F> ELSE 0 ENDIF

Unlikely(Box<AstElem<P>>)

IF <F> ELSE 0 ENDIF

AndCat(Box<AstElem<P>>, Box<AstElem<P>>)

<V> <T/V/F/Q>

AndBool(Box<AstElem<P>>, Box<AstElem<P>>)

<E> <W> BOOLAND

AndCasc(Box<AstElem<P>>, Box<AstElem<P>>)

<E> NOTIF 0 ELSE <F> ENDIF

OrBool(Box<AstElem<P>>, Box<AstElem<P>>)

<E> <W> BoolOr

OrCasc(Box<AstElem<P>>, Box<AstElem<P>>)

<E> IFDUP NOTIF <T/E> ENDIF

OrCont(Box<AstElem<P>>, Box<AstElem<P>>)

<E> NOTIF <V> ENDIF

OrKey(Box<AstElem<P>>, Box<AstElem<P>>)

IF <Q> ELSE <Q> ENDIF CHECKSIG

OrKeyV(Box<AstElem<P>>, Box<AstElem<P>>)

IF <Q> ELSE <Q> ENDIF CHECKSIGVERIFY

OrIf(Box<AstElem<P>>, Box<AstElem<P>>)

IF <sub1> ELSE <sub2> ENDIF for many choices of sub1 and sub2

OrIfV(Box<AstElem<P>>, Box<AstElem<P>>)

IF <T> ELSE <T> ENDIF VERIFY

OrNotif(Box<AstElem<P>>, Box<AstElem<P>>)

NOTIF <F> ELSE <E> ENDIF

Thresh(usizeVec<AstElem<P>>)

<E> (<W> ADD)* <n> EQUAL

ThreshV(usizeVec<AstElem<P>>)

<E> (<W> ADD)* <n> EQUALVERIFY

Methods

impl<P> AstElem<P>[src]

pub fn is_e(&self) -> bool[src]

Does the element satisfy the "expression" calling convention?

pub fn is_q(&self) -> bool[src]

Does the element satisfy the "queue" calling convention?

pub fn is_w(&self) -> bool[src]

Does the element satisfy the "wrapped" calling convention?

pub fn is_f(&self) -> bool[src]

Does the element satisfy the "forced" calling convention?

pub fn is_v(&self) -> bool[src]

Does the element satisfy the "verify" calling convention?

pub fn is_t(&self) -> bool[src]

Does the element satisfy the "toplevel" calling convention?

pub fn translate<Func, Q, Error>(
    &self,
    translatefn: &mut Func
) -> Result<AstElem<Q>, Error> where
    Func: FnMut(&P) -> Result<Q, Error>, 
[src]

Convert an AST element with one public key type to one of another public key type

impl<P: Clone> AstElem<P>[src]

pub fn abstract_policy(&self) -> AbstractPolicy<P>[src]

Abstract the script into an "abstract policy" which can be filtered and analyzed

pub fn public_keys(&self) -> Vec<P>[src]

Return a list of all public keys which might contribute to satisfaction of the scriptpubkey

impl<P: ToPublicKey> AstElem<P>[src]

pub fn encode(&self, builder: Builder) -> Builder[src]

Encode the element as a fragment of Bitcoin Script. The inverse function, from Script to an AST element, is implemented in the parse module.

pub fn script_size(&self) -> usize[src]

Size, in bytes of the script-pubkey. If this Miniscript is used outside of segwit (e.g. in a bare or P2SH descriptor), this quantity should be multiplied by 4 to compute the weight.

In general, it is not recommended to use this function directly, but to instead call the corresponding function on a Descriptor, which will handle the segwit/non-segwit technicalities for you.

pub fn max_dissatisfaction_witness_elements(&self) -> usize[src]

Maximum number of witness elements used to dissatisfy the Miniscript fragment. Used to estimate the weight of the VarInt that specifies this number in a serialized transaction.

Will panic if you give it a non-E non-W fragment.

pub fn max_dissatisfaction_size(&self, one_cost: usize) -> usize[src]

Maximum dissatisfaction cost, in bytes, of a Miniscript fragment, if it is possible to compute this. This function should probably not ever be used directly. It is called from max_satisfaction_size.

Will panic if you give it a non-E non-W fragment.

pub fn max_satisfaction_witness_elements(&self) -> usize[src]

Maximum number of witness elements used to satisfy the Miniscript fragment. Used to estimate the weight of the VarInt that specifies this number in a serialized transaction.

This number does not include the witness script itself, so 1 needs to be added to the final result.

pub fn max_satisfaction_size(&self, one_cost: usize) -> usize[src]

Maximum size, in bytes, of a satisfying witness. For Segwit outputs one_cost should be set to 2, since the number 1 requires two bytes to encode. For non-segwit outputs one_cost should be set to 1, since OP_1 is available in scriptSigs.

In general, it is not recommended to use this function directly, but to instead call the corresponding function on a Descriptor, which will handle the segwit/non-segwit technicalities for you.

All signatures are assumed to be 73 bytes in size, including the length prefix (segwit) or push opcode (pre-segwit) and sighash postfix.

This function may panic on misformed Miniscript objects which do not correspond to semantically sane Scripts. (Such scripts should be rejected at parse time. Any exceptions are bugs.)

Trait Implementations

impl<P: ToPublicKey> Satisfiable<P> for AstElem<P>[src]

impl<P: ToPublicKey> Dissatisfiable<P> for AstElem<P>[src]

impl<P: FromStr> FromTree for AstElem<P> where
    <P as FromStr>::Err: ToString
[src]

impl<P: Eq> Eq for AstElem<P>[src]

impl<P: Ord> Ord for AstElem<P>[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<P: PartialEq> PartialEq<AstElem<P>> for AstElem<P>[src]

impl<P: Clone> Clone for AstElem<P>[src]

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

Performs copy-assignment from source. Read more

impl<P: PartialOrd> PartialOrd<AstElem<P>> for AstElem<P>[src]

impl<P> From<AstElem<P>> for Miniscript<P>[src]

impl<P: Debug> Debug for AstElem<P>[src]

impl<P: Display> Display for AstElem<P>[src]

Auto Trait Implementations

impl<P> Send for AstElem<P> where
    P: Send

impl<P> Sync for AstElem<P> where
    P: Sync

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]