Struct bitcoin_scripts::taproot::BranchNode
source · [−]pub struct BranchNode { /* private fields */ }Expand description
Ordered set of two branches under taptree node.
Implementations
sourceimpl BranchNode
impl BranchNode
sourcepub fn split(self) -> (TreeNode, TreeNode)
pub fn split(self) -> (TreeNode, TreeNode)
Splits the structure into the left and right nodes, ordered according to bitcoin consensus rules (by the lexicographic order of the node hash values).
sourcepub fn split_dfs(self) -> (TreeNode, TreeNode)
pub fn split_dfs(self) -> (TreeNode, TreeNode)
Splits the structure into the left and right nodes, ordered according to the original DFS order.
sourcepub fn as_left_node(&self) -> &TreeNode
pub fn as_left_node(&self) -> &TreeNode
Returns reference for to left (in bitcoin consensus lexicographic ordering) child node.
sourcepub fn as_right_node(&self) -> &TreeNode
pub fn as_right_node(&self) -> &TreeNode
Returns reference for to right (in bitcoin consensus lexicographic ordering) child node.
sourcepub fn as_dfs_child_node(&self, direction: DfsOrder) -> &TreeNode
pub fn as_dfs_child_node(&self, direction: DfsOrder) -> &TreeNode
Returns reference to the child node at specific DFS direction.
sourcepub fn as_dfs_first_node(&self) -> &TreeNode
pub fn as_dfs_first_node(&self) -> &TreeNode
Returns reference to the first (in DFS ordering) child node.
sourcepub fn as_dfs_last_node(&self) -> &TreeNode
pub fn as_dfs_last_node(&self) -> &TreeNode
Returns reference to the last (in DFS ordering) child node.
Trait Implementations
sourceimpl Branch for BranchNode
impl Branch for BranchNode
sourcefn subtree_depth(&self) -> Option<u8>
fn subtree_depth(&self) -> Option<u8>
Returns the depth of the subtree under this branch node, if the subtree
is fully known (i.e. does not contain hidden nodes), or None
otherwise. The depth of subtree for leaf nodes is zero. Read more
sourcefn dfs_ordering(&self) -> DfsOrdering
fn dfs_ordering(&self) -> DfsOrdering
Returns correspondence between internal child node ordering and their DFS ordering. Read more
sourcefn branch_hash(&self) -> TapBranchHash
fn branch_hash(&self) -> TapBranchHash
Computes branch hash of this branch node.
sourceimpl Clone for BranchNode
impl Clone for BranchNode
sourcefn clone(&self) -> BranchNode
fn clone(&self) -> BranchNode
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for BranchNode
impl Debug for BranchNode
sourceimpl Hash for BranchNode
impl Hash for BranchNode
sourceimpl Ord for BranchNode
impl Ord for BranchNode
sourceimpl PartialEq<BranchNode> for BranchNode
impl PartialEq<BranchNode> for BranchNode
sourcefn eq(&self, other: &BranchNode) -> bool
fn eq(&self, other: &BranchNode) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &BranchNode) -> bool
fn ne(&self, other: &BranchNode) -> bool
This method tests for !=.
sourceimpl PartialOrd<BranchNode> for BranchNode
impl PartialOrd<BranchNode> for BranchNode
sourcefn partial_cmp(&self, other: &BranchNode) -> Option<Ordering>
fn partial_cmp(&self, other: &BranchNode) -> 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 StrictDecode for BranchNode
impl StrictDecode for BranchNode
sourcefn strict_decode<D: Read>(d: D) -> Result<Self, Error>
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
Decode with the given std::io::Read instance; must either
construct an instance or return implementation-specific error type. Read more
sourcefn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
StrictDecode::strict_decode Read more
sourceimpl StrictEncode for BranchNode
impl StrictEncode for BranchNode
sourcefn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
Encode with the given std::io::Write instance; must return result
with either amount of bytes encoded – or implementation-specific
error type. Read more
sourcefn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
Serializes data as a byte array using StrictEncode::strict_encode
function Read more
impl Eq for BranchNode
impl StructuralEq for BranchNode
impl StructuralPartialEq for BranchNode
Auto Trait Implementations
impl RefUnwindSafe for BranchNode
impl Send for BranchNode
impl Sync for BranchNode
impl Unpin for BranchNode
impl UnwindSafe for BranchNode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more