pub trait Sorter<R> {
    fn compare(&self, a: &R, b: &R) -> Ordering;

    fn sort_vec(&self, vec: &mut Vec<R>) { ... }
    fn sort_ref_vec(&self, vec: &mut Vec<&R>) { ... }
}
Expand description

Something that can compare two values of another type T.

While Ord is a sensible trait for types that can have only one ordering, it needs to be generalised when a type can have multiple orderings according to some parameterisation. Sorter is just that generalisation.

Required methods

Provided methods

Sort a Vec in place.

Sort a Vec of references in place.

Implementors