pub trait Collate {
    type Value;

    fn compare(&self, left: &Self::Value, right: &Self::Value) -> Ordering;

    fn bisect<V: AsRef<[Self::Value]>, B: Borrow<[Self::Value]>>(
        &self,
        slice: &[V],
        range: &Range<Self::Value, B>
    ) -> (usize, usize) { ... } fn bisect_left<V: AsRef<[Self::Value]>>(
        &self,
        slice: &[V],
        key: &[Self::Value]
    ) -> usize { ... } fn bisect_right<V: AsRef<[Self::Value]>>(
        &self,
        slice: &[V],
        key: &[Self::Value]
    ) -> usize { ... } fn compare_range<B: Borrow<[Self::Value]>>(
        &self,
        key: &[Self::Value],
        range: &Range<Self::Value, B>
    ) -> Ordering { ... } fn compare_slice<L: AsRef<[Self::Value]>, R: AsRef<[Self::Value]>>(
        &self,
        left: L,
        right: R
    ) -> Ordering { ... } fn is_sorted<V: AsRef<[Self::Value]>>(&self, slice: &[V]) -> bool { ... } }
Expand description

Defines methods to collate a collection of slices of type Value, given a comparator.

Required Associated Types

Required Methods

Define the relative ordering of Self::Value.

Provided Methods

Given a collection of slices, return the start and end indices which match the given range.

Given a collection of slices, return the leftmost insert point matching the given key.

Given a collection of slices, return the rightmost insert point matching the given key.

Returns the ordering of the given key relative to the given range.

Returns the relative ordering of the left slice with respect to right.

Returns true if the given slice is in sorted order.

Implementors