pub struct TaprootScriptTree { /* private fields */ }
Expand description

Taproot script tree which keeps internal information in a tree data structure, which can be modified by adding or removing parts of the tree (subtrees). See Self::join, Self::split, Self::instill, Self::cut operations.

The structure can be build out of (or converted into) TapTree taproot tree representation, which doesn’t have a modifiable tree structure.

Implementations

Constructs new script tree from the root node.

Errors.

If any of the branches under the root node has non-consensus ordering of the child nodes (i.e. by lexicographic order of the node hash values).

Returns iterator over known scripts stored in the tree.

NB: the iterator ignores scripts behind hidden nodes.

Returns iterator over all known nodes of the tree.

Returns iterator over all subnodes on a given path.

Traverses tree using the provided path in DFS order and returns the node reference at the tip of the path.

Errors

Returns DfsTraversalError if the path can’t be traversed.

Joins two trees together under a new root.

Creates a new tree with the root node containing self and other_tree as its direct children. The other_tree is put into other_dfs_order side.

Splits the tree into two subtrees. Errors if the tree root is hidden or a script leaf.

Returns

Two child nodes under the root of the original tree as a new taproot script trees in the original DFS ordering.

Instills other_tree as a subtree under provided path by creating a new branch node at the path and putting other_tree on the dfs_side of it.

Error

Returns InstillError when the given path can’t be traversed or the resulting tree depth exceeds taproot tree depth limit.

Cuts subtree out of this tree at the path, returning this tree without the cut branch and the cut subtree as a new tree.

Returns

Modified original tree without the cut node and a new tree constructed out of the cut node.

Error

Returns DfsTraversalError when the given path can’t be traversed or points at an unsplittable node (leaf node or a hidden node).

Returns reference to the root node of the tree.

Consumes the tree and returns instance of the root node of the tree.

Returns a cloned root node.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

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

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

This method tests for !=.

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

Decode with the given std::io::Read instance; must either construct an instance or return implementation-specific error type. Read more

Tries to deserialize byte array into the current type using StrictDecode::strict_decode Read more

Reads data from file at path and reconstructs object from it. Fails with Error::DataNotEntirelyConsumed if file contains remaining data after the object reconstruction. Read more

Encode with the given std::io::Write instance; must return result with either amount of bytes encoded – or implementation-specific error type. Read more

Serializes data as a byte array using StrictEncode::strict_encode function Read more

Saves data to a file at a given path. If the file does not exists, attempts to create the file. If the file already exists, it gets truncated. Read more

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

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.