Trait xi_rope::tree::NodeInfo
[−]
[src]
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.
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 sum operator 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.
Provided Methods
fn identity() -> Self
The identity of the monoid. Need not be implemented because it can be computed from the leaf default.
fn interval(&self, len: usize) -> Interval
The interval covered by this node. Will generally be implemented in interval trees; the default impl is sufficient for other types.
Implementors
impl NodeInfo for BreaksInfo
impl NodeInfo for RopeInfo
impl<T: Clone + Default> NodeInfo for SpansInfo<T>