Dimension

Trait Dimension 

Source
pub trait Dimension<'a, S: Summary>: Clone {
    // Required methods
    fn zero(cx: S::Context<'_>) -> Self;
    fn add_summary(&mut self, summary: &'a S, cx: S::Context<'_>);

    // Provided method
    fn from_summary(summary: &'a S, cx: S::Context<'_>) -> Self { ... }
}
Expand description

Each Summary type can have more than one Dimension type that it measures.

You can use dimensions to seek to a specific location in the SumTree

§Example:

Zed’s rope has a TextSummary type that summarizes lines, characters, and bytes. Each of these are different dimensions we may want to seek to

Required Methods§

Source

fn zero(cx: S::Context<'_>) -> Self

Source

fn add_summary(&mut self, summary: &'a S, cx: S::Context<'_>)

Provided Methods§

Source

fn from_summary(summary: &'a S, cx: S::Context<'_>) -> Self

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.

Implementations on Foreign Types§

Source§

impl<'a, T: Summary> Dimension<'a, T> for ()

Source§

fn zero(_: T::Context<'_>) -> Self

Source§

fn add_summary(&mut self, _: &'a T, _: T::Context<'_>)

Implementors§

Source§

impl<'a, T: Summary> Dimension<'a, T> for T

Source§

impl<'a, T: Summary, D1: Dimension<'a, T>, D2: Dimension<'a, T>, D3: Dimension<'a, T>> Dimension<'a, T> for Dimensions<D1, D2, D3>