Struct iodyn::level_tree::Tree
[−]
[src]
pub struct Tree<E: 'static + Debug + Clone + Eq + Hash> { /* fields omitted */ }
A persistent tree with stable, internally defined structure
Methods
impl<E: Debug + Clone + Eq + Hash + 'static> Tree<E>
[src]
fn new(
level: u32,
name: Option<Name>,
data: E,
l_branch: Option<Tree<E>>,
r_branch: Option<Tree<E>>
) -> Option<Tree<E>>
level: u32,
name: Option<Name>,
data: E,
l_branch: Option<Tree<E>>,
r_branch: Option<Tree<E>>
) -> Option<Tree<E>>
build a new tree from components, always succeeds //return None if levels are inconsistent
fn level(&self) -> u32
peek at the level of the root of this tree
fn name(&self) -> Option<Name>
peek at the name of the root of this tree
fn l_tree(&self) -> Option<Tree<E>>
obtain the left subtree if it exists
fn r_tree(&self) -> Option<Tree<E>>
obtain the right subtree if it exists
fn peek(&self) -> E
peek at the data contained at the top node of the tree
fn fold_up<R: Eq + Clone + Hash + Debug + 'static, F>(
self,
node_calc: Rc<F>
) -> R where
F: 'static + Fn(Option<R>, E, Option<R>) -> R,
self,
node_calc: Rc<F>
) -> R where
F: 'static + Fn(Option<R>, E, Option<R>) -> R,
incremental fold operation, from leaves to root
fn fold_up_meta<R: Eq + Clone + Hash + Debug + 'static, F>(
self,
node_calc: Rc<F>
) -> R where
F: 'static + Fn(Option<R>, E, u32, Option<Name>, Option<R>) -> R,
self,
node_calc: Rc<F>
) -> R where
F: 'static + Fn(Option<R>, E, u32, Option<Name>, Option<R>) -> R,
incremental tree fold operation with levels and names
Names passed to the mapping function are USED (as is and forked) in the resulting tree and should not be reused directly for the creation of arts.
fn fold_lr<A, F>(self, accum: A, node_calc: Rc<F>) -> A where
A: 'static + Eq + Clone + Hash + Debug,
F: 'static + Fn(A, E) -> A,
A: 'static + Eq + Clone + Hash + Debug,
F: 'static + Fn(A, E) -> A,
incremental fold operation, left to right
fn fold_lr_meta<A, F>(
self,
start_name: Option<Name>,
accum: A,
node_calc: Rc<F>
) -> A where
A: 'static + Eq + Clone + Hash + Debug,
F: 'static + Fn(A, E, u32, Option<Name>) -> A,
self,
start_name: Option<Name>,
accum: A,
node_calc: Rc<F>
) -> A where
A: 'static + Eq + Clone + Hash + Debug,
F: 'static + Fn(A, E, u32, Option<Name>) -> A,
incremental fold operation, left to right, with levels and names
Names passed to the mapping function are USED (as is and forked) in the resulting tree and should not be reused directly for the creation of arts.
fn map<R: Eq + Clone + Hash + Debug + 'static, F>(
self,
map_val: Rc<F>
) -> Tree<R> where
F: 'static + Fn(E, u32, Option<Name>, Option<&Tree<R>>, Option<&Tree<R>>) -> R,
self,
map_val: Rc<F>
) -> Tree<R> where
F: 'static + Fn(E, u32, Option<Name>, Option<&Tree<R>>, Option<&Tree<R>>) -> R,
incremental map operation
because of the possibility of meta data in tree nodes, the mapping function takes all the data of a tree, including refs to subtrees. Names passed to the mapping function are USED in the resulting tree and should not be reused directly for the creation of arts.
Trait Implementations
impl<E: Debug + 'static + Debug + Clone + Eq + Hash> Debug for Tree<E>
[src]
impl<E: PartialEq + 'static + Debug + Clone + Eq + Hash> PartialEq for Tree<E>
[src]
fn eq(&self, __arg_0: &Tree<E>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Tree<E>) -> bool
This method tests for !=
.
impl<E: Eq + 'static + Debug + Clone + Eq + Hash> Eq for Tree<E>
[src]
impl<E: Hash + 'static + Debug + Clone + Eq + Hash> Hash for Tree<E>
[src]
fn hash<__HE: Hasher>(&self, __arg_0: &mut __HE)
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<E: Debug + Clone + Eq + Hash + 'static> Clone for Tree<E>
[src]
fn clone(&self) -> Self
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