pub struct Node<TP: TreeProperties> { /* private fields */ }
Expand description
Node in tree
Implementations§
Source§impl<TP: TreeProperties> Node<TP>
impl<TP: TreeProperties> Node<TP>
Sourcepub fn get_value_mut(&mut self) -> &mut TP::Value
pub fn get_value_mut(&mut self) -> &mut TP::Value
Get mutable value of node
Sourcepub fn get_leaf_value(&self) -> Option<&TP::LeafValue>
pub fn get_leaf_value(&self) -> Option<&TP::LeafValue>
Return reference to leaf value if node is a leaf
Sourcepub fn get_leaf_value_mut(&mut self) -> Option<&mut TP::LeafValue>
pub fn get_leaf_value_mut(&mut self) -> Option<&mut TP::LeafValue>
Return mutable reference to leaf value if node is a leaf
Sourcepub fn set_leaf_value(&mut self, value: TP::LeafValue) -> &mut TP::LeafValue
pub fn set_leaf_value(&mut self, value: TP::LeafValue) -> &mut TP::LeafValue
Make node a leaf node (i.e. drop potential child nodes) and set leaf value
Sourcepub fn get_or_make_leaf_value_with<F>(&mut self, f: F) -> &mut TP::LeafValue
pub fn get_or_make_leaf_value_with<F>(&mut self, f: F) -> &mut TP::LeafValue
Return mutable reference to leaf value
If node isn’t a leaf, make it one and initialize it with given constructor
Sourcepub fn get_children(&self) -> Option<(&Self, &Self)>
pub fn get_children(&self) -> Option<(&Self, &Self)>
Return reference to (left, right) child nodes unless node is a leaf
Sourcepub fn get_children_mut(&mut self) -> Option<(&mut Self, &mut Self)>
pub fn get_children_mut(&mut self) -> Option<(&mut Self, &mut Self)>
Return mutable reference to (left, right) child nodes unless node is a leaf
Sourcepub fn get_left(&self) -> Option<&Self>
pub fn get_left(&self) -> Option<&Self>
Return reference to left child node unless node is a leaf
Sourcepub fn get_left_mut(&mut self) -> Option<&mut Self>
pub fn get_left_mut(&mut self) -> Option<&mut Self>
Return mutable reference to left child node unless node is a leaf
Sourcepub fn get_right(&self) -> Option<&Self>
pub fn get_right(&self) -> Option<&Self>
Return reference to right child node unless node is a leaf
Sourcepub fn get_right_mut(&mut self) -> Option<&mut Self>
pub fn get_right_mut(&mut self) -> Option<&mut Self>
Return mutable reference to right child node unless node is a leaf
Sourcepub fn get_child(&self, side_bit: bool) -> Option<&Node<TP>>
pub fn get_child(&self, side_bit: bool) -> Option<&Node<TP>>
Return reference to requested child node unless node is a leaf
false
returns left and true
returns right node.
Sourcepub fn get_child_mut(&mut self, side_bit: bool) -> Option<&mut Node<TP>>
pub fn get_child_mut(&mut self, side_bit: bool) -> Option<&mut Node<TP>>
Return mutable reference to requested child node unless node is a leaf
false
returns left and true
returns right node.