Enum sapio_miniscript::miniscript::decode::Terminal
source · [−]pub enum Terminal<Pk: MiniscriptKey, Ctx: ScriptContext> {
Show 27 variants
True,
False,
PkK(Pk),
PkH(Pk::Hash),
After(u32),
Older(u32),
Sha256(Hash),
Hash256(Hash),
Ripemd160(Hash),
Hash160(Hash),
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>),
TxTemplate(Hash),
}
Expand description
All AST elements
Variants
True
1
False
0
PkK(Pk)
<key>
PkH(Pk::Hash)
DUP HASH160 <keyhash> EQUALVERIFY
After(u32)
n CHECKLOCKTIMEVERIFY
Older(u32)
n CHECKSEQUENCEVERIFY
Sha256(Hash)
SIZE 32 EQUALVERIFY SHA256 <hash> EQUAL
Hash256(Hash)
SIZE 32 EQUALVERIFY HASH256 <hash> EQUAL
Ripemd160(Hash)
SIZE 32 EQUALVERIFY RIPEMD160 <hash> EQUAL
Hash160(Hash)
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 (
TxTemplate(Hash)
<hash> OP_CHECKTEMPLATEVERIFY OP_DROP
Implementations
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx>
sourcepub fn encode(&self, builder: Builder) -> Builder where
Pk: ToPublicKey,
pub fn encode(&self, builder: Builder) -> Builder where
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.
sourcepub fn script_size(&self) -> usize
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
sourceimpl<Pk: Clone + MiniscriptKey, Ctx: Clone + ScriptContext> Clone for Terminal<Pk, Ctx> where
Pk::Hash: Clone,
impl<Pk: Clone + MiniscriptKey, Ctx: Clone + ScriptContext> Clone for Terminal<Pk, Ctx> where
Pk::Hash: Clone,
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> Debug for Terminal<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Debug for Terminal<Pk, Ctx>
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> Display for Terminal<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Display for Terminal<Pk, Ctx>
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> ForEachKey<Pk> for Terminal<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> ForEachKey<Pk> for Terminal<Pk, Ctx>
sourceimpl<Pk, Ctx> FromTree for Terminal<Pk, Ctx> where
Pk: MiniscriptKey + FromStr,
Pk::Hash: FromStr,
Ctx: ScriptContext,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
impl<Pk, Ctx> FromTree for Terminal<Pk, Ctx> where
Pk: MiniscriptKey + FromStr,
Pk::Hash: FromStr,
Ctx: ScriptContext,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
sourceimpl<Pk: Hash + MiniscriptKey, Ctx: Hash + ScriptContext> Hash for Terminal<Pk, Ctx> where
Pk::Hash: Hash,
impl<Pk: Hash + MiniscriptKey, Ctx: Hash + ScriptContext> Hash for Terminal<Pk, Ctx> where
Pk::Hash: Hash,
sourceimpl<Pk: MiniscriptKey, Ctx: ScriptContext> Liftable<Pk> for Terminal<Pk, Ctx>
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Liftable<Pk> for Terminal<Pk, Ctx>
sourceimpl<Pk: Ord + MiniscriptKey, Ctx: Ord + ScriptContext> Ord for Terminal<Pk, Ctx> where
Pk::Hash: Ord,
impl<Pk: Ord + MiniscriptKey, Ctx: Ord + ScriptContext> Ord for Terminal<Pk, Ctx> where
Pk::Hash: Ord,
sourceimpl<Pk: PartialEq + MiniscriptKey, Ctx: PartialEq + ScriptContext> PartialEq<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx> where
Pk::Hash: PartialEq,
impl<Pk: PartialEq + MiniscriptKey, Ctx: PartialEq + ScriptContext> PartialEq<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx> where
Pk::Hash: PartialEq,
sourceimpl<Pk: PartialOrd + MiniscriptKey, Ctx: PartialOrd + ScriptContext> PartialOrd<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx> where
Pk::Hash: PartialOrd,
impl<Pk: PartialOrd + MiniscriptKey, Ctx: PartialOrd + ScriptContext> PartialOrd<Terminal<Pk, Ctx>> for Terminal<Pk, Ctx> where
Pk::Hash: PartialOrd,
sourcefn partial_cmp(&self, other: &Terminal<Pk, Ctx>) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
sourceimpl<Pk: MiniscriptKey, Q: MiniscriptKey, Ctx: ScriptContext> TranslatePk<Pk, Q> for Terminal<Pk, Ctx>
impl<Pk: MiniscriptKey, Q: MiniscriptKey, Ctx: ScriptContext> TranslatePk<Pk, Q> for Terminal<Pk, Ctx>
sourcefn translate_pk<FPk, FPkh, FuncError>(
&self,
translatefpk: FPk,
translatefpkh: FPkh
) -> Result<Self::Output, FuncError> where
FPk: FnMut(&Pk) -> Result<Q, FuncError>,
FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, FuncError>,
fn translate_pk<FPk, FPkh, FuncError>(
&self,
translatefpk: FPk,
translatefpkh: FPkh
) -> Result<Self::Output, FuncError> where
FPk: FnMut(&Pk) -> Result<Q, FuncError>,
FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, FuncError>,
Convert an AST element with one public key type to one of another public key type .This will panic while converting to Segwit Miniscript using uncompressed public keys
impl<Pk: Eq + MiniscriptKey, Ctx: Eq + ScriptContext> Eq for Terminal<Pk, Ctx> where
Pk::Hash: Eq,
impl<Pk: MiniscriptKey, Ctx: ScriptContext> StructuralEq for Terminal<Pk, Ctx>
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>::Hash: RefUnwindSafe,
impl<Pk, Ctx> Send for Terminal<Pk, Ctx> where
Ctx: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk, Ctx> Sync for Terminal<Pk, Ctx> where
Ctx: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk, Ctx> Unpin for Terminal<Pk, Ctx> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk, Ctx> UnwindSafe for Terminal<Pk, Ctx> where
Ctx: RefUnwindSafe,
Pk: UnwindSafe + RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<P, Q, T> TranslatePk1<P, Q> for T where
P: MiniscriptKey,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
T: TranslatePk<P, Q>,
impl<P, Q, T> TranslatePk1<P, Q> for T where
P: MiniscriptKey,
Q: MiniscriptKey<Hash = <P as MiniscriptKey>::Hash>,
T: TranslatePk<P, Q>,
sourcefn translate_pk1<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
fn translate_pk1<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more
sourcefn translate_pk1_infallible<Fpk: FnMut(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
fn translate_pk1_infallible<Fpk: FnMut(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more
sourceimpl<P, Q, T> TranslatePk2<P, Q> for T where
P: MiniscriptKey<Hash = P>,
Q: MiniscriptKey,
T: TranslatePk<P, Q>,
impl<P, Q, T> TranslatePk2<P, Q> for T where
P: MiniscriptKey<Hash = P>,
Q: MiniscriptKey,
T: TranslatePk<P, Q>,
sourcefn translate_pk2<Fpk: Fn(&P) -> Result<Q, E>, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
fn translate_pk2<Fpk: Fn(&P) -> Result<Q, E>, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E>
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more
sourcefn translate_pk2_infallible<Fpk: Fn(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
fn translate_pk2_infallible<Fpk: Fn(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more
sourceimpl<P, Q, T> TranslatePk3<P, Q> for T where
P: MiniscriptKey + ToPublicKey,
Q: MiniscriptKey<Hash = Hash>,
T: TranslatePk<P, Q>,
impl<P, Q, T> TranslatePk3<P, Q> for T where
P: MiniscriptKey + ToPublicKey,
Q: MiniscriptKey<Hash = Hash>,
T: TranslatePk<P, Q>,
sourcefn translate_pk3<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
fn translate_pk3<Fpk, E>(
&self,
translatefpk: Fpk
) -> Result<<Self as TranslatePk<P, Q>>::Output, E> where
Fpk: FnMut(&P) -> Result<Q, E>,
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more
sourcefn translate_pk3_infallible<Fpk: FnMut(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
fn translate_pk3_infallible<Fpk: FnMut(&P) -> Q>(
&self,
translatefpk: Fpk
) -> <Self as TranslatePk<P, Q>>::Output
Translate a struct from one generic to another where the translation for Pk is provided by translatefpk Read more