Struct lz_diet::DietNode
[−]
[src]
pub struct DietNode<T> { /* fields omitted */ }
Methods
impl<T> DietNode<T>
[src]
Trait Implementations
impl<T: Debug> Debug for DietNode<T>
[src]
impl<T: PartialEq> PartialEq for DietNode<T>
[src]
fn eq(&self, __arg_0: &DietNode<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &DietNode<T>) -> bool
This method tests for !=
.
impl<T: Eq> Eq for DietNode<T>
[src]
impl<T: Clone> Clone for DietNode<T>
[src]
fn clone(&self) -> DietNode<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: Hash> Hash for DietNode<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> Node for DietNode<T>
[src]
type Value = Interval<T>
fn left(&self) -> Option<&Self>
Get a reference to the left subtree
fn right(&self) -> Option<&Self>
Get a reference to the right subtree
fn value(&self) -> &Self::Value
Returns the value of the current node.
fn walk<'a, F>(&'a self, step_in: F) where
F: FnMut(&'a Self) -> WalkAction,
F: FnMut(&'a Self) -> WalkAction,
Walk down the tree
impl<T> NodeMut for DietNode<T>
[src]
type NodePtr = DietNodePtr<T>
fn detach_left(&mut self) -> Option<Self::NodePtr>
Try to detach the left sub-tree
fn detach_right(&mut self) -> Option<Self::NodePtr>
Try to detach the right sub-tree
fn insert_left(&mut self, tree: Option<Self::NodePtr>) -> Option<Self::NodePtr>
Replace the left subtree with tree
and return the old one.
fn insert_right(&mut self, tree: Option<Self::NodePtr>) -> Option<Self::NodePtr>
Replace the right subtree with tree
and return the old one.
fn value_mut(&mut self) -> &mut Self::Value
Returns a mutable reference to the value of the current node.
fn into_parts(
self
) -> (Self::Value, Option<Self::NodePtr>, Option<Self::NodePtr>)
self
) -> (Self::Value, Option<Self::NodePtr>, Option<Self::NodePtr>)
Consume a Node and return its parts: (value, left, right)
fn left_mut(&mut self) -> Option<&mut Self>
Returns a mutable reference to the left child
fn right_mut(&mut self) -> Option<&mut Self>
Returns a mutable reference to the right child
fn rotate_left(&mut self) -> Result<(), ()>
Try to rotate the tree left if right subtree exists
fn rotate_right(&mut self) -> Result<(), ()>
Try to rotate the tree right if left subtree exists
fn walk_mut<'a, FI, FS>(&'a mut self, step_in: FI, stop: FS) where
FI: FnMut(&Self) -> WalkAction,
FS: FnOnce(&'a mut Self) -> (),
FI: FnMut(&Self) -> WalkAction,
FS: FnOnce(&'a mut Self) -> (),
Simple mutable walk Read more
fn walk_reshape<FI, FS, FO>(&mut self, step_in: FI, stop: FS, step_out: FO) where
FI: FnMut(&mut Self) -> WalkAction,
FO: FnMut(&mut Self, WalkAction) -> (),
FS: FnOnce(&mut Self) -> (),
FI: FnMut(&mut Self) -> WalkAction,
FO: FnMut(&mut Self, WalkAction) -> (),
FS: FnOnce(&mut Self) -> (),
Walks down the tree by detaching subtrees, then up reattaching them back. step_in
should guide the path taken, stop
will be called on the node where either step_in
returned Stop
or it was not possible to proceed. Then step_out
will be called for each node along the way to root, except the final one (that for which stop
was called). Read more
fn insert_before<F>(&mut self, new_node: Self::NodePtr, step_out: F) where
F: FnMut(&mut Self, WalkAction) -> (),
F: FnMut(&mut Self, WalkAction) -> (),
Insert new_node
in-order before self
. step_out
will be invoked for all nodes in path from (excluding) the point of insertion, to (including) self
, unless self
is the point of insertion. Read more
fn walk_extract<FI, FE, FO>(
&mut self,
step_in: FI,
extract: FE,
step_out: FO
) -> Option<Self::NodePtr> where
FE: FnOnce(&mut Self, &mut Option<Self::NodePtr>) -> (),
FI: FnMut(&mut Self) -> WalkAction,
FO: FnMut(&mut Self, WalkAction) -> (),
&mut self,
step_in: FI,
extract: FE,
step_out: FO
) -> Option<Self::NodePtr> where
FE: FnOnce(&mut Self, &mut Option<Self::NodePtr>) -> (),
FI: FnMut(&mut Self) -> WalkAction,
FO: FnMut(&mut Self, WalkAction) -> (),
Extract out a node. This can be used in conjuction with try_remove
to remove any node except the root. Read more
fn try_remove<F>(&mut self, step_out: F) -> Option<Self::NodePtr> where
F: FnMut(&mut Self, WalkAction) -> (),
F: FnMut(&mut Self, WalkAction) -> (),
Replace this node with one of its descendant, returns None
if it has no children. Read more