pub enum Terminal<Pk: MiniscriptKey, Ctx: ScriptContext> {
Show 28 variants True, False, PkK(Pk), PkH(Pk), RawPkH(Hash), After(AbsLockTime), Older(Sequence), Sha256(Pk::Sha256), Hash256(Pk::Hash256), Ripemd160(Pk::Ripemd160), Hash160(Pk::Hash160), Alt(Arc<Miniscript<Pk, Ctx>>), Swap(Arc<Miniscript<Pk, Ctx>>), Check(Arc<Miniscript<Pk, Ctx>>), DupIf(Arc<Miniscript<Pk, Ctx>>), Verify(Arc<Miniscript<Pk, Ctx>>), NonZero(Arc<Miniscript<Pk, Ctx>>), ZeroNotEqual(Arc<Miniscript<Pk, Ctx>>), AndV(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>), AndB(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>), AndOr(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>), OrB(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>), OrD(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>), OrC(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>), OrI(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>), Thresh(usize, Vec<Arc<Miniscript<Pk, Ctx>>>), Multi(usize, Vec<Pk>), MultiA(usize, Vec<Pk>),
}
Expand description

All AST elements.

This variant is the inner Miniscript variant that allows the user to bypass some of the miniscript rules. You should never construct Terminal directly. This is only exposed to external users to allow matching on the Miniscript.

The average user should always use the Descriptor APIs. Advanced users who want deal with Miniscript ASTs should use the Miniscript APIs.

Variants§

§

True

1

§

False

0

§

PkK(Pk)

<key>

§

PkH(Pk)

DUP HASH160 <keyhash> EQUALVERIFY

§

RawPkH(Hash)

Only for parsing PkH for Script. These raw descriptors are not yet specified in miniscript. We only this variant internally for inferring miniscripts from raw Scripts. It is not possible to construct this variant from any of the Miniscript APIs. We don’t have a generic over here because we don’t want to user to have any abstract reasoning over raw descriptors.

§

After(AbsLockTime)

n CHECKLOCKTIMEVERIFY

§

Older(Sequence)

n CHECKSEQUENCEVERIFY

§

Sha256(Pk::Sha256)

SIZE 32 EQUALVERIFY SHA256 <hash> EQUAL

§

Hash256(Pk::Hash256)

SIZE 32 EQUALVERIFY HASH256 <hash> EQUAL

§

Ripemd160(Pk::Ripemd160)

SIZE 32 EQUALVERIFY RIPEMD160 <hash> EQUAL

§

Hash160(Pk::Hash160)

SIZE 32 EQUALVERIFY HASH160 <hash> EQUAL

§

Alt(Arc<Miniscript<Pk, Ctx>>)

TOALTSTACK [E] FROMALTSTACK

§

Swap(Arc<Miniscript<Pk, Ctx>>)

SWAP [E1]

§

Check(Arc<Miniscript<Pk, Ctx>>)

[Kt]/[Ke] CHECKSIG

§

DupIf(Arc<Miniscript<Pk, Ctx>>)

DUP IF [V] ENDIF

§

Verify(Arc<Miniscript<Pk, Ctx>>)

[T] VERIFY

§

NonZero(Arc<Miniscript<Pk, Ctx>>)

SIZE 0NOTEQUAL IF [Fn] ENDIF

§

ZeroNotEqual(Arc<Miniscript<Pk, Ctx>>)

[X] 0NOTEQUAL

§

AndV(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)

[V] [T]/[V]/[F]/[Kt]

§

AndB(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)

[E] [W] BOOLAND

§

AndOr(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)

[various] NOTIF [various] ELSE [various] ENDIF

§

OrB(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)

[E] [W] BOOLOR

§

OrD(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)

[E] IFDUP NOTIF [T]/[E] ENDIF

§

OrC(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)

[E] NOTIF [V] ENDIF

§

OrI(Arc<Miniscript<Pk, Ctx>>, Arc<Miniscript<Pk, Ctx>>)

IF [various] ELSE [various] ENDIF

§

Thresh(usize, Vec<Arc<Miniscript<Pk, Ctx>>>)

[E] ([W] ADD)* k EQUAL

§

Multi(usize, Vec<Pk>)

k (<key>)* n CHECKMULTISIG

§

MultiA(usize, Vec<Pk>)

<key> CHECKSIG (<key> CHECKSIGADD)*(n-1) k NUMEQUAL

Implementations§

source§

impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx>

source

pub fn encode(&self, builder: Builder) -> Builderwhere Pk: ToPublicKey,

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

source

pub fn script_size(&self) -> usize

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.

Trait Implementations§

source§

impl<Pk: Clone + MiniscriptKey, Ctx: Clone + ScriptContext> Clone for Terminal<Pk, Ctx>where Pk::Sha256: Clone, Pk::Hash256: Clone, Pk::Ripemd160: Clone, Pk::Hash160: Clone,

source§

fn clone(&self) -> Terminal<Pk, Ctx>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Pk: MiniscriptKey, Ctx: ScriptContext> Debug for Terminal<Pk, Ctx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Pk: MiniscriptKey, Ctx: ScriptContext> Display for Terminal<Pk, Ctx>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Pk: MiniscriptKey, Ctx: ScriptContext> ForEachKey<Pk> for Terminal<Pk, Ctx>

source§

fn for_each_key<'a, F: FnMut(&'a Pk) -> bool>(&'a self, pred: F) -> bool

Run a predicate on every key in the descriptor, returning whether the predicate returned true for every key
source§

fn for_any_key<'a, F: FnMut(&'a Pk) -> bool>(&'a self, pred: F) -> boolwhere Pk: 'a,

Run a predicate on every key in the descriptor, returning whether the predicate returned true for any key
source§

impl<Pk, Ctx> FromTree for Terminal<Pk, Ctx>where Pk: MiniscriptKey + FromStr, Pk::Sha256: FromStr, Pk::Hash256: FromStr, Pk::Ripemd160: FromStr, Pk::Hash160: FromStr, <Pk as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Sha256 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Hash256 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Ripemd160 as FromStr>::Err: ToString, <<Pk as MiniscriptKey>::Hash160 as FromStr>::Err: ToString, Ctx: ScriptContext,

source§

fn from_tree(top: &Tree<'_>) -> Result<Terminal<Pk, Ctx>, Error>

Extract a structure from Tree representation
source§

impl<Pk: Hash + MiniscriptKey, Ctx: Hash + ScriptContext> Hash for Terminal<Pk, Ctx>where Pk::Sha256: Hash, Pk::Hash256: Hash, Pk::Ripemd160: Hash, Pk::Hash160: Hash,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

Feeds a slice of this type into the given Hasher. Read more
source§

impl<Pk: MiniscriptKey, Ctx: ScriptContext> Liftable<Pk> for Terminal<Pk, Ctx>

source§

fn lift(&self) -> Result<Semantic<Pk>, Error>

Convert the object into an abstract policy
source§

impl<Pk: Ord + MiniscriptKey, Ctx: Ord + ScriptContext> Ord for Terminal<Pk, Ctx>where Pk::Sha256: Ord, Pk::Hash256: Ord, Pk::Ripemd160: Ord, Pk::Hash160: Ord,

source§

fn cmp(&self, other: &Terminal<Pk, Ctx>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<Pk: PartialEq + MiniscriptKey, Ctx: PartialEq + ScriptContext> PartialEq<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx>where Pk::Sha256: PartialEq, Pk::Hash256: PartialEq, Pk::Ripemd160: PartialEq, Pk::Hash160: PartialEq,

source§

fn eq(&self, other: &Terminal<Pk, Ctx>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Pk: PartialOrd + MiniscriptKey, Ctx: PartialOrd + ScriptContext> PartialOrd<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx>where Pk::Sha256: PartialOrd, Pk::Hash256: PartialOrd, Pk::Ripemd160: PartialOrd, Pk::Hash160: PartialOrd,

source§

fn partial_cmp(&self, other: &Terminal<Pk, Ctx>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<Pk, Q, Ctx> TranslatePk<Pk, Q> for Terminal<Pk, Ctx>where Pk: MiniscriptKey, Q: MiniscriptKey, Ctx: ScriptContext,

source§

fn translate_pk<T, E>( &self, translate: &mut T ) -> Result<Self::Output, TranslateErr<E>>where T: Translator<Pk, Q, E>,

Converts an AST element with one public key type to one of another public key type.

§

type Output = Terminal<Q, Ctx>

The associated output type. This must be Self<Q>.
source§

impl<Pk: Eq + MiniscriptKey, Ctx: Eq + ScriptContext> Eq for Terminal<Pk, Ctx>where Pk::Sha256: Eq, Pk::Hash256: Eq, Pk::Ripemd160: Eq, Pk::Hash160: Eq,

source§

impl<Pk: MiniscriptKey, Ctx: ScriptContext> StructuralEq for Terminal<Pk, Ctx>

source§

impl<Pk: MiniscriptKey, Ctx: ScriptContext> StructuralPartialEq for Terminal<Pk, Ctx>

Auto Trait Implementations§

§

impl<Pk, Ctx> RefUnwindSafe for Terminal<Pk, Ctx>where Ctx: RefUnwindSafe, Pk: RefUnwindSafe, <Pk as MiniscriptKey>::Hash160: RefUnwindSafe, <Pk as MiniscriptKey>::Hash256: RefUnwindSafe, <Pk as MiniscriptKey>::Ripemd160: RefUnwindSafe, <Pk as MiniscriptKey>::Sha256: RefUnwindSafe,

§

impl<Pk, Ctx> Send for Terminal<Pk, Ctx>where Ctx: Send + Sync, Pk: Send + Sync, <Pk as MiniscriptKey>::Hash160: Send + Sync, <Pk as MiniscriptKey>::Hash256: Send + Sync, <Pk as MiniscriptKey>::Ripemd160: Send + Sync, <Pk as MiniscriptKey>::Sha256: Send + Sync,

§

impl<Pk, Ctx> Sync for Terminal<Pk, Ctx>where Ctx: Send + Sync, Pk: Send + Sync, <Pk as MiniscriptKey>::Hash160: Send + Sync, <Pk as MiniscriptKey>::Hash256: Send + Sync, <Pk as MiniscriptKey>::Ripemd160: Send + Sync, <Pk as MiniscriptKey>::Sha256: Send + Sync,

§

impl<Pk, Ctx> Unpin for Terminal<Pk, Ctx>where Pk: Unpin, <Pk as MiniscriptKey>::Hash160: Unpin, <Pk as MiniscriptKey>::Hash256: Unpin, <Pk as MiniscriptKey>::Ripemd160: Unpin, <Pk as MiniscriptKey>::Sha256: Unpin,

§

impl<Pk, Ctx> UnwindSafe for Terminal<Pk, Ctx>where Ctx: RefUnwindSafe, Pk: UnwindSafe + RefUnwindSafe, <Pk as MiniscriptKey>::Hash160: UnwindSafe + RefUnwindSafe, <Pk as MiniscriptKey>::Hash256: UnwindSafe + RefUnwindSafe, <Pk as MiniscriptKey>::Ripemd160: UnwindSafe + RefUnwindSafe, <Pk as MiniscriptKey>::Sha256: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V