pub struct BranchNode;Expand description
Helper functions for branch nodes.
Implementations§
Source§impl BranchNode
impl BranchNode
Sourcepub fn set_partners(node: &NodeRef, partners: Option<Rc<RefCell<MatchedNodes>>>)
pub fn set_partners(node: &NodeRef, partners: Option<Rc<RefCell<MatchedNodes>>>)
Sourcepub fn set_base_match(
node: &NodeRef,
base: Weak<RefCell<NodeInner>>,
match_type: MatchType,
) -> Result<()>
pub fn set_base_match( node: &NodeRef, base: Weak<RefCell<NodeInner>>, match_type: MatchType, ) -> Result<()>
Sourcepub fn del_base_match(node: &NodeRef)
pub fn del_base_match(node: &NodeRef)
Sourcepub fn base_match_type(node: &NodeRef) -> MatchType
pub fn base_match_type(node: &NodeRef) -> MatchType
Sourcepub fn has_base_match(node: &NodeRef) -> bool
pub fn has_base_match(node: &NodeRef) -> bool
Sourcepub fn base_match(node: &NodeRef) -> Option<NodeRef>
pub fn base_match(node: &NodeRef) -> Option<NodeRef>
Sourcepub fn is_left_tree(node: &NodeRef) -> bool
pub fn is_left_tree(node: &NodeRef) -> bool
Returns true if this node is in the left tree.
This is determined by checking if this node (or an ancestor) is in the left matches of its base match.
§Panics
Panics if the node is not a branch node, or if no matched ancestor is found.
Sourcepub fn set_is_left_tree(node: &NodeRef, is_left: bool)
pub fn set_is_left_tree(node: &NodeRef, is_left: bool)
Sourcepub fn is_match(node: &NodeRef, type_flags: MatchType) -> bool
pub fn is_match(node: &NodeRef, type_flags: MatchType) -> bool
Returns true if this node’s match type includes the given flags.
§Panics
Panics if the node is not a branch node.
Sourcepub fn first_partner(node: &NodeRef, type_flags: MatchType) -> Option<NodeRef>
pub fn first_partner(node: &NodeRef, type_flags: MatchType) -> Option<NodeRef>
Finds the first partner node that matches the given type flags.
For a node to be returned:
- This node’s match type must include the given flags
- The partner’s match type must include the given flags
§Panics
Panics if the node is not a branch node.
Sourcepub fn child(node: &NodeRef, index: usize) -> NodeRef
pub fn child(node: &NodeRef, index: usize) -> NodeRef
Gets the child at the given index, asserting it’s a branch node.
§Panics
Panics if the index is out of bounds or if the child is not a branch node.
Auto Trait Implementations§
impl Freeze for BranchNode
impl RefUnwindSafe for BranchNode
impl Send for BranchNode
impl Sync for BranchNode
impl Unpin for BranchNode
impl UnsafeUnpin for BranchNode
impl UnwindSafe for BranchNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more