pub struct RazTree<E: 'static + Debug + Clone + Eq + Hash, M: RazMeta<E> + 'static> { /* private fields */ }Expand description
Tree form of a RAZ
used between refocusing, and for running global algorithms
Implementations§
Source§impl<E: Debug + Clone + Eq + Hash + 'static, M: RazMeta<E>> RazTree<E, M>
impl<E: Debug + Clone + Eq + Hash + 'static, M: RazMeta<E>> RazTree<E, M>
pub fn is_empty(&self) -> bool
Sourcepub fn join(
ltree: Self,
level: u32,
name: Option<Name>,
rtree: Self,
) -> Option<Self>
pub fn join( ltree: Self, level: u32, name: Option<Name>, rtree: Self, ) -> Option<Self>
Combine two trees left to right
returns None if either tree is empty.
Sourcepub fn from_vec(vec: Vec<E>) -> Option<Self>
pub 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
Sourcepub fn fold_up<I, R, B>(self, init: Rc<I>, bin: Rc<B>) -> Option<R>
pub fn fold_up<I, R, B>(self, init: Rc<I>, bin: Rc<B>) -> Option<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.
Sourcepub fn fold_up_nl<I, R, B, N>(
self,
init: Rc<I>,
bin: Rc<B>,
binnl: Rc<N>,
) -> Option<R>
pub fn fold_up_nl<I, R, B, N>( self, init: Rc<I>, bin: Rc<B>, binnl: Rc<N>, ) -> Option<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.
Sourcepub fn fold_up_gauged<I, R, B>(self, init: Rc<I>, bin: Rc<B>) -> Option<R>
pub fn fold_up_gauged<I, R, B>(self, init: Rc<I>, bin: Rc<B>) -> Option<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.
Sourcepub fn fold_lr<A, B>(self, init: A, bin: Rc<B>) -> A
pub fn fold_lr<A, B>(self, init: A, bin: Rc<B>) -> A
Runs an incremental fold over the sequence, left to right
Sourcepub fn fold_lr_meta<A, B, N>(self, init: A, bin: Rc<B>, meta: Rc<N>) -> A
pub fn fold_lr_meta<A, B, N>(self, init: A, bin: Rc<B>, meta: Rc<N>) -> A
left-to-right memoized fold with levels and names
Sourcepub fn fold_lr_archive<A, B, F, N>(
self,
init: A,
bin: Rc<B>,
finbin: Rc<F>,
meta: Rc<N>,
) -> A
pub fn fold_lr_archive<A, B, F, N>( self, init: A, bin: Rc<B>, finbin: Rc<F>, meta: Rc<N>, ) -> A
left-to-right incremental fold with levels and names, with a name provided at the leaf
Sourcepub fn map<R, F, N: RazMeta<R>>(self, f: Rc<F>) -> RazTree<R, N>
pub fn map<R, F, N: RazMeta<R>>(self, f: Rc<F>) -> RazTree<R, N>
An incremental mapping of the tree, returning a new tree
Sourcepub fn focus<I: Into<M::Index>>(self, index: I) -> Option<Raz<E, M>>
pub fn focus<I: Into<M::Index>>(self, index: I) -> Option<Raz<E, M>>
focus on a location in the sequence to begin editing.
Sourcepub fn focus_left(self) -> Raz<E, M>
pub fn focus_left(self) -> Raz<E, M>
focus on the first element in the sequence