Trait binary_heap_plus::Compare
[−]
[src]
pub trait Compare<T>: Clone { fn compare(&mut self, a: &T, b: &T) -> Ordering; }
Simpler replacement for the Ord
trait.
The difference is that you can define multiple sort orders on a single type T
.
Unlike Ord
trait, Compare<T>
trait can be easily implemented by providing a single function.
Required Methods
Implementors
impl<T: Ord> Compare<T> for MaxComparator
impl<T: Ord> Compare<T> for MinComparator
impl<T, F> Compare<T> for FnComparator<F> where
F: Clone + FnMut(&T, &T) -> Ordering,impl<K: Ord, T, F> Compare<T> for KeyComparator<F> where
F: Clone + FnMut(&T) -> K,