pub struct Miniscript<Pk: MiniscriptKey, Ctx: ScriptContext> {
    pub node: Terminal<Pk, Ctx>,
    pub ty: Type,
    pub ext: ExtData,
    /* private fields */
}
Expand description

Top-level script AST type

Fields

node: Terminal<Pk, Ctx>

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.

Implementations

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.

Extracts the AstElem representing the root of the miniscript

Attempt to parse a script into a Miniscript representation

Encode as a Bitcoin script

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.

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.)

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.)

This will panic if translatefpk returns an uncompressed key when converting to a Segwit descriptor. To prevent this panic, ensure translatefpk returns an error in this case instead.

Attempt to produce a satisfying witness for the witness script represented by the parse tree

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Parse an expression tree into a Miniscript. As a general rule, this should not be called directly; rather go through the descriptor API.

Feeds this value into the given Hasher. Read more

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

Convert the object into an abstract policy

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.

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

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

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

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

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

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

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.