[−][src]Struct miniscript::miniscript::Miniscript
Top-level script AST type
Fields
node: Terminal<Pk>
A node in the Abstract Syntax Tree(
ty: Type
The correctness and malleability type information for the AST node
ext: ExtData
Additional information helpful for extra analysis.
Methods
impl<Pk: MiniscriptKey> Miniscript<Pk>
[src]
pub fn from_ast(t: Terminal<Pk>) -> Result<Miniscript<Pk>, Error>
[src]
Add type information(Type and Extdata) to Miniscript based on
AstElem
fragment. Dependent on display and clone because of Error
Display code of type_check.
impl<Pk: MiniscriptKey> Miniscript<Pk>
[src]
pub fn into_inner(self) -> Terminal<Pk>
[src]
Extracts the AstElem
representing the root of the miniscript
pub fn as_inner(&self) -> &Terminal<Pk>
[src]
impl Miniscript<PublicKey>
[src]
pub fn parse(script: &Script) -> Result<Miniscript<PublicKey>, Error>
[src]
Attempt to parse a script into a Miniscript representation
impl<Pk: MiniscriptKey + ToPublicKey> Miniscript<Pk>
[src]
pub fn encode(&self) -> Script
[src]
Encode as a Bitcoin script
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_satisfaction_witness_elements(&self) -> usize
[src]
Maximum number of witness elements used to satisfy the Miniscript
fragment, including the witness script itself. Used to estimate
the weight of the VarInt
that specifies this number in a serialized
transaction.
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.)
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.)
impl<Pk: MiniscriptKey> Miniscript<Pk>
[src]
pub fn translate_pk<FPk, FPkh, Q, Error>(
&self,
translatefpk: &mut FPk,
translatefpkh: &mut FPkh
) -> Result<Miniscript<Q>, Error> where
FPk: FnMut(&Pk) -> Result<Q, Error>,
FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, Error>,
Q: MiniscriptKey,
[src]
&self,
translatefpk: &mut FPk,
translatefpkh: &mut FPkh
) -> Result<Miniscript<Q>, Error> where
FPk: FnMut(&Pk) -> Result<Q, Error>,
FPkh: FnMut(&Pk::Hash) -> Result<Q::Hash, Error>,
Q: MiniscriptKey,
impl<Pk: MiniscriptKey + ToPublicKey> Miniscript<Pk>
[src]
pub fn satisfy<S: Satisfier<Pk>>(&self, satisfier: S) -> Option<Vec<Vec<u8>>>
[src]
Attempt to produce a satisfying witness for the witness script represented by the parse tree
Trait Implementations
impl<Pk> FromTree for Miniscript<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
fn from_tree(top: &Tree) -> Result<Miniscript<Pk>, Error>
[src]
Parse an expression tree into a Miniscript. As a general rule, this should not be called directly; rather go through the descriptor API.
impl<Pk: MiniscriptKey> Liftable<Pk> for Miniscript<Pk>
[src]
impl<Pk: MiniscriptKey> Eq for Miniscript<Pk>
[src]
Eq
of Miniscript
must depend only on node and not the type information.
The type information and extra_properties can be deterministically determined
by the ast tree.
impl<Pk: Clone + MiniscriptKey> Clone for Miniscript<Pk>
[src]
fn clone(&self) -> Miniscript<Pk>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Pk: MiniscriptKey> PartialOrd<Miniscript<Pk>> for Miniscript<Pk>
[src]
PartialOrd
of Miniscript
must depend only on node and not the type information.
The type information and extra_properties can be deterministically determined
by the ast tree.
fn partial_cmp(&self, other: &Miniscript<Pk>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<Pk: MiniscriptKey> PartialEq<Miniscript<Pk>> for Miniscript<Pk>
[src]
PartialEq
of Miniscript
must depend only on node and not the type information.
The type information and extra_properties can be deterministically determined
by the ast tree.
fn eq(&self, other: &Miniscript<Pk>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<Pk: MiniscriptKey> Ord for Miniscript<Pk>
[src]
Ord
of Miniscript
must depend only on node and not the type information.
The type information and extra_properties can be deterministically determined
by the ast tree.
fn cmp(&self, other: &Miniscript<Pk>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<Pk: Hash + MiniscriptKey> Hash for Miniscript<Pk>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<Pk: MiniscriptKey> Display for Miniscript<Pk>
[src]
impl<Pk: MiniscriptKey> Debug for Miniscript<Pk>
[src]
impl<Pk> FromStr for Miniscript<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
[src]
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
Auto Trait Implementations
impl<Pk> Send for Miniscript<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Unpin for Miniscript<Pk> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> Sync for Miniscript<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> RefUnwindSafe for Miniscript<Pk> where
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk> UnwindSafe for Miniscript<Pk> where
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,