Trait NodeInfo
pub trait NodeInfo: Clone {
type L: Leaf;
// Required methods
fn accumulate(&mut self, other: &Self);
fn compute_info(_: &Self::L) -> Self;
// Provided methods
fn identity() -> Self { ... }
fn interval(&self, len: usize) -> Interval { ... }
}Required Associated Types§
Required Methods§
fn accumulate(&mut self, other: &Self)
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
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
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.