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.
Trait Implementations§
Auto Trait Implementations§
impl<TP> Freeze for Node<TP>where
<TP as TreeProperties>::Key: Freeze,
<TP as TreeProperties>::Value: Freeze,
<TP as TreeProperties>::LeafValue: Freeze,
impl<TP> RefUnwindSafe for Node<TP>where
<TP as TreeProperties>::Key: RefUnwindSafe,
<TP as TreeProperties>::Value: RefUnwindSafe,
<TP as TreeProperties>::LeafValue: RefUnwindSafe,
impl<TP> Send for Node<TP>where
<TP as TreeProperties>::Key: Send,
<TP as TreeProperties>::Value: Send,
<TP as TreeProperties>::LeafValue: Send,
impl<TP> Sync for Node<TP>where
<TP as TreeProperties>::Key: Sync,
<TP as TreeProperties>::Value: Sync,
<TP as TreeProperties>::LeafValue: Sync,
impl<TP> Unpin for Node<TP>where
<TP as TreeProperties>::Key: Unpin,
<TP as TreeProperties>::Value: Unpin,
<TP as TreeProperties>::LeafValue: Unpin,
impl<TP> UnwindSafe for Node<TP>where
<TP as TreeProperties>::Key: UnwindSafe,
<TP as TreeProperties>::Value: UnwindSafe,
<TP as TreeProperties>::LeafValue: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)