[][src]Trait xi_rope::tree::NodeInfo

pub trait NodeInfo: Clone {
    type L: Leaf;
    fn accumulate(&mut self, other: &Self);
fn compute_info(_: &Self::L) -> Self; fn identity() -> Self { ... }
fn interval(&self, len: usize) -> Interval { ... } }

Associated Types

type L: Leaf

The type of the leaf.

A given NodeInfo is for exactly one type of leaf. That is why the leaf type is an associated type rather than a type parameter.

Loading content...

Required methods

fn accumulate(&mut self, other: &Self)

An operator that combines info from two subtrees. It is intended (but not strictly enforced) that this operator be associative and obey an identity property. In mathematical terms, the accumulate method is the operation of a monoid.

fn compute_info(_: &Self::L) -> Self

A mapping from a leaf into the info type. It is intended (but not strictly enforced) that applying the accumulate method to the info derived from two leaves gives the same result as deriving the info from the concatenation of the two leaves. In mathematical terms, the compute_info method is a monoid homomorphism.

Loading content...

Provided methods

fn identity() -> Self

The identity of the monoid. Need not be implemented because it can be computed from the leaf default.

This is here to demonstrate that this is a monoid.

fn interval(&self, len: usize) -> Interval

The interval covered by the first len base units of this node. The default impl is sufficient for most types, but interval trees may need to override it.

Loading content...

Implementors

impl NodeInfo for BreaksInfo[src]

type L = BreaksLeaf

impl NodeInfo for RopeInfo[src]

type L = String

impl<T: Clone> NodeInfo for SpansInfo<T>[src]

type L = SpansLeaf<T>

Loading content...