[][src]Trait collate::Collate

pub trait Collate {
    type Value;
    pub fn compare(&self, left: &Self::Value, right: &Self::Value) -> Ordering;

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

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

Associated Types

Loading content...

Required methods

pub fn compare(&self, left: &Self::Value, right: &Self::Value) -> Ordering[src]

Define the relative ordering of Self::Value.

Loading content...

Provided methods

pub fn bisect<V: AsRef<[Self::Value]>, B: Borrow<[Self::Value]>>(
    &self,
    slice: &[V],
    range: &Range<Self::Value, B>
) -> (usize, usize)
[src]

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

pub fn bisect_left<V: AsRef<[Self::Value]>>(
    &self,
    slice: &[V],
    key: &[Self::Value]
) -> usize
[src]

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

pub fn bisect_right<V: AsRef<[Self::Value]>>(
    &self,
    slice: &[V],
    key: &[Self::Value]
) -> usize
[src]

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

pub fn compare_range<B: Borrow<[Self::Value]>>(
    &self,
    key: &[Self::Value],
    range: &Range<Self::Value, B>
) -> Ordering
[src]

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

pub fn compare_slice<L: AsRef<[Self::Value]>, R: AsRef<[Self::Value]>>(
    &self,
    left: L,
    right: R
) -> Ordering
[src]

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

pub fn is_sorted<V: AsRef<[Self::Value]>>(&self, slice: &[V]) -> bool[src]

Returns true if the given slice is in sorted order.

Loading content...

Implementors

impl<T: Ord> Collate for Collator<T>[src]

type Value = T

Loading content...