[−][src]Function classific::at_greatest
pub fn at_greatest<T, F>(is_at_greatest: F) -> AtGreatest<T, F> where
T: ?Sized,
F: Fn(&T) -> bool,
This function returns a Comparator
for T
which divides T
instances into 2 categories.
- the ones for which
is_at_least
returnstrue
: these are consideredOrdering::Less
than the other category, andOrdering::Equal
to each other - and the ones for which
is_at_least
returnsfalse
: these are consideredOrdering::Greater
than the other category, andOrdering::Equal
to each other
See at_least
and partial_order_or
.
Examples
use std::cmp::Ordering; use classific::{Comparator, at_greatest, partial_order_or}; assert_eq!(partial_order_or(at_greatest(|f: &f64| f.is_nan())).cmp(&f64::NAN, &1_f64), Ordering::Greater); assert_eq!(partial_order_or(at_greatest(|f: &f64| f.is_nan())).cmp(&f64::NAN, &f64::NAN), Ordering::Equal); assert_eq!(partial_order_or(at_greatest(|f: &f64| f.is_nan())).cmp(&1_f64, &f64::NAN), Ordering::Less);