RazTree

Struct RazTree 

Source
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>

Source

pub fn meta(&self) -> &M

get the meta data

Source

pub fn is_empty(&self) -> bool

Source

pub fn empty() -> Self

create a new RazTree with no data

Source

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.

Source

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

Source

pub 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,

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.

Source

pub 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,

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.

Source

pub 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,

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.

Source

pub 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,

Runs an incremental fold over the sequence, left to right

Source

pub 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,

left-to-right memoized fold with levels and names

Source

pub 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,

left-to-right incremental fold with levels and names, with a name provided at the leaf

Source

pub 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,

An incremental mapping of the tree, returning a new tree

Source

pub fn focus<I: Into<M::Index>>(self, index: I) -> Option<Raz<E, M>>

focus on a location in the sequence to begin editing.

Source

pub fn focus_left(self) -> Raz<E, M>

focus on the first element in the sequence

Trait Implementations§

Source§

impl<E: Clone + 'static + Debug + Clone + Eq + Hash, M: Clone + RazMeta<E> + 'static> Clone for RazTree<E, M>

Source§

fn clone(&self) -> RazTree<E, M>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug + 'static + Debug + Clone + Eq + Hash, M: Debug + RazMeta<E> + 'static> Debug for RazTree<E, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Hash + 'static + Debug + Clone + Eq + Hash, M: Hash + RazMeta<E> + 'static> Hash for RazTree<E, M>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<E: Debug + Clone + Eq + Hash + 'static, M: RazMeta<E>> MemoFrom<AtHead<E, u32>> for RazTree<E, M>

Source§

fn memo_from(headstack: &AtHead<E, u32>) -> Self

Source§

impl<E: Debug + Clone + Eq + Hash + 'static, M: RazMeta<E>> MemoFrom<AtTail<E, u32>> for RazTree<E, M>

Source§

fn memo_from(tailstack: &AtTail<E, u32>) -> Self

Source§

impl<E: PartialEq + 'static + Debug + Clone + Eq + Hash, M: PartialEq + RazMeta<E> + 'static> PartialEq for RazTree<E, M>

Source§

fn eq(&self, other: &RazTree<E, M>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Eq + 'static + Debug + Clone + Eq + Hash, M: Eq + RazMeta<E> + 'static> Eq for RazTree<E, M>

Source§

impl<E: 'static + Debug + Clone + Eq + Hash, M: RazMeta<E> + 'static> StructuralPartialEq for RazTree<E, M>

Auto Trait Implementations§

§

impl<E, M> Freeze for RazTree<E, M>
where M: Freeze,

§

impl<E, M> !RefUnwindSafe for RazTree<E, M>

§

impl<E, M> !Send for RazTree<E, M>

§

impl<E, M> !Sync for RazTree<E, M>

§

impl<E, M> Unpin for RazTree<E, M>
where M: Unpin,

§

impl<E, M> !UnwindSafe for RazTree<E, M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MemoFrom<T> for T
where T: Clone,

Source§

fn memo_from(t: &T) -> T

Source§

impl<T, U> MemoInto<U> for T
where T: Clone, U: MemoFrom<T>,

Source§

fn memo_into(&self) -> U

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.