Struct iodyn::raz::RazTree
[−]
[src]
pub struct RazTree<E: 'static + Debug + Clone + Eq + Hash, M: RazMeta<E> + 'static> { /* fields omitted */ }
Tree form of a RAZ
used between refocusing, and for running global algorithms
Methods
impl<E: Debug + Clone + Eq + Hash + 'static, M: RazMeta<E>> RazTree<E, M>
[src]
fn meta(&self) -> &M
get the meta data
fn is_empty(&self) -> bool
fn empty() -> Self
create a new RazTree with no data
fn join(
ltree: Self,
level: u32,
name: Option<Name>,
rtree: Self
) -> Option<Self>
ltree: Self,
level: u32,
name: Option<Name>,
rtree: Self
) -> Option<Self>
Combine two trees left to right
returns None if either tree is empty.
fn from_vec(vec: Vec<E>) -> Option<Self>
Make a RazTree from a Vec
This tree will contain no levels or names Returns None if the Vec is empty
fn fold_up<I, R, B>(self, init: Rc<I>, bin: Rc<B>) -> Option<R> where
R: 'static + Eq + Clone + Hash + Debug,
I: 'static + Fn(&E) -> R,
B: 'static + Fn(R, R) -> R,
R: 'static + Eq + Clone + Hash + Debug,
I: 'static + Fn(&E) -> R,
B: 'static + Fn(R, R) -> R,
Runs an incremental binary function over the sequence data
This is calculated from data in leaves of a tree structure, so the operation must be associative. Returns None if there are no elements.
fn fold_up_nl<I, R, B, N>(
self,
init: Rc<I>,
bin: Rc<B>,
binnl: Rc<N>
) -> Option<R> where
R: 'static + Eq + Clone + Hash + Debug,
I: 'static + Fn(&E) -> R,
B: 'static + Fn(R, R) -> R,
N: 'static + Fn(R, u32, Option<Name>, R) -> R,
self,
init: Rc<I>,
bin: Rc<B>,
binnl: Rc<N>
) -> Option<R> where
R: 'static + Eq + Clone + Hash + Debug,
I: 'static + Fn(&E) -> R,
B: 'static + Fn(R, R) -> R,
N: 'static + Fn(R, u32, Option<Name>, R) -> R,
Runs an incremental binary function over the sequence data, levels, and names
This is calculated from data in leaves of a tree structure, so the operation must be associative. Returns None if there are no elements.
fn fold_up_gauged<I, R, B>(self, init: Rc<I>, bin: Rc<B>) -> Option<R> where
R: 'static + Eq + Clone + Hash + Debug,
I: 'static + Fn(&Vec<E>) -> R,
B: 'static + Fn(R, u32, Option<Name>, R) -> R,
R: 'static + Eq + Clone + Hash + Debug,
I: 'static + Fn(&Vec<E>) -> R,
B: 'static + Fn(R, u32, Option<Name>, R) -> R,
Runs an incremental binary function over subsequences, levels, and names
Subsequences allow potential for optimization. The binary function still operates on the results from the subsequence conputation.
fn fold_lr<A, B>(self, init: A, bin: Rc<B>) -> A where
A: 'static + Eq + Clone + Hash + Debug,
B: 'static + Fn(A, &E) -> A,
A: 'static + Eq + Clone + Hash + Debug,
B: 'static + Fn(A, &E) -> A,
Runs an incremental fold over the sequence, left to right
fn fold_lr_meta<A, B, N>(self, init: A, bin: Rc<B>, meta: Rc<N>) -> A where
A: 'static + Eq + Clone + Hash + Debug,
B: 'static + Fn(A, &E) -> A,
N: 'static + Fn(A, (u32, Option<Name>)) -> A,
A: 'static + Eq + Clone + Hash + Debug,
B: 'static + Fn(A, &E) -> A,
N: 'static + Fn(A, (u32, Option<Name>)) -> A,
left-to-right memoized fold with levels and names
fn fold_lr_archive<A, B, F, N>(
self,
init: A,
bin: Rc<B>,
finbin: Rc<F>,
meta: Rc<N>
) -> A where
A: 'static + Eq + Clone + Hash + Debug,
B: 'static + Fn(A, &E) -> A,
F: 'static + Fn(A, Option<Name>) -> A,
N: 'static + Fn(A, u32) -> A,
self,
init: A,
bin: Rc<B>,
finbin: Rc<F>,
meta: Rc<N>
) -> A where
A: 'static + Eq + Clone + Hash + Debug,
B: 'static + Fn(A, &E) -> A,
F: 'static + Fn(A, Option<Name>) -> A,
N: 'static + Fn(A, u32) -> A,
left-to-right incremental fold with levels and names, with a name provided at the leaf
fn map<R, F, N: RazMeta<R>>(self, f: Rc<F>) -> RazTree<R, N> where
R: 'static + Eq + Clone + Hash + Debug,
F: 'static + Fn(&E) -> R,
R: 'static + Eq + Clone + Hash + Debug,
F: 'static + Fn(&E) -> R,
An incremental mapping of the tree, returning a new tree
fn focus<I: Into<M::Index>>(self, index: I) -> Option<Raz<E, M>>
focus on a location in the sequence to begin editing.
fn focus_left(self) -> Raz<E, M>
focus on the first element in the sequence
Trait Implementations
impl<E: Clone + 'static + Debug + Clone + Eq + Hash, M: Clone + RazMeta<E> + 'static> Clone for RazTree<E, M>
[src]
fn clone(&self) -> RazTree<E, M>
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<E: PartialEq + 'static + Debug + Clone + Eq + Hash, M: PartialEq + RazMeta<E> + 'static> PartialEq for RazTree<E, M>
[src]
fn eq(&self, __arg_0: &RazTree<E, M>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RazTree<E, M>) -> bool
This method tests for !=
.
impl<E: Eq + 'static + Debug + Clone + Eq + Hash, M: Eq + RazMeta<E> + 'static> Eq for RazTree<E, M>
[src]
impl<E: Debug + 'static + Debug + Clone + Eq + Hash, M: Debug + RazMeta<E> + 'static> Debug for RazTree<E, M>
[src]
impl<E: Hash + 'static + Debug + Clone + Eq + Hash, M: Hash + RazMeta<E> + 'static> Hash for RazTree<E, M>
[src]
fn hash<__HEM: Hasher>(&self, __arg_0: &mut __HEM)
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