Struct evco::gp::tree::BoxTree
[−]
[src]
pub struct BoxTree<T>(_) where T: Tree;
Box
Wrapper for implementations of Tree.
Methods
impl<T> BoxTree<T> where T: Tree
[src]
fn inner(self) -> T
Extract the internal Tree
.
fn count_nodes(&mut self) -> usize
Count the number of nodes below this node in the tree.
fn get(&mut self, target_index: usize) -> Option<T>
Get a clone of a particular value.
fn map<F>(&mut self, f: F) where F: FnMut(&mut T, usize, usize)
Traverse the tree with the ability to mutate nodes in-place.
The callback receives a mutable pointer to the current node, the 0-based current iteration count, and the 0-based current depth in the tree.
fn map_while<F>(&mut self, f: F) where F: FnMut(&mut T, usize, usize) -> bool
Traverse the tree until the function returns false
.
The callback receives a mutable pointer to the current node, the 0-based current iteration count, and the 0-based current depth in the tree.
The callback returns a bool
. If false
the loop terminates.
fn fold<F, V>(&mut self, value: V, f: F) -> V where F: FnMut(V, &mut T, usize, usize) -> V
Traverse the tree building up a return value, with the ability to mutate nodes in-place.
The callback receives the value being built up, a mutable pointer to the current node, the 0-based current iteration count, and the 0-based current depth in the tree.
fn fold_while<F, V>(&mut self, value: V, f: F) -> V where F: FnMut(V, &mut T, usize, usize) -> (bool, V)
Traverse the tree building up a return value, with the ability to mutate nodes in-place.
The callback receives the value being built up, a mutable pointer to the current node, the 0-based current iteration count, and the 0-based current depth in the tree.
The callback returns a pair of (bool, fold_value)
. If false
the loop terminates.
Trait Implementations
impl<T: Clone> Clone for BoxTree<T> where T: Tree
[src]
fn clone(&self) -> BoxTree<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: PartialEq> PartialEq for BoxTree<T> where T: Tree
[src]
fn eq(&self, __arg_0: &BoxTree<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &BoxTree<T>) -> bool
This method tests for !=
.
impl<T: Eq> Eq for BoxTree<T> where T: Tree
[src]
impl<T> Debug for BoxTree<T> where T: Tree
[src]
Make BoxTree
invisible in Debug
output. At the cost of a little invisibility this
makes Tree
s far more readable.
impl<T> Display for BoxTree<T> where T: Tree + Display
[src]
impl<T> Deref for BoxTree<T> where T: Tree
[src]
type Target = T
The resulting type after dereferencing
fn deref(&self) -> &T
The method called to dereference a value
impl<T> DerefMut for BoxTree<T> where T: Tree
[src]
fn deref_mut(&mut self) -> &mut T
The method called to mutably dereference a value