Trait an_rope::metric::Metric
[−]
[src]
pub trait Metric: Monoid + Eq + Add<usize, Output = Self> + Sub<usize, Output = Self> + Sub<Self, Output = Self> + Eq + Ord + Sized + Into<usize> + Copy + Debug { fn is_splittable() -> bool; fn is_boundary<M: Measured<Self>>(node: &M, i: usize) -> bool; fn next<M: Measured<Self>>(self, node: &M) -> Option<usize> { ... } fn back<M: Measured<Self>>(self, node: &M) -> Option<usize> { ... } }
A monoid that can be applied to a type as a measurement.
Required Methods
fn is_splittable() -> bool
Returns whether text may be split into new leaf nodes using this metric.
fn is_boundary<M: Measured<Self>>(node: &M, i: usize) -> bool
Returns true if index i
in node
is a boundary along this Metric
Provided Methods
fn next<M: Measured<Self>>(self, node: &M) -> Option<usize>
Returns the byte index of the next element of this metric in Node
fn back<M: Measured<Self>>(self, node: &M) -> Option<usize>
Returns the byte index of the previous element of this metric in Node