[−][src]Function classific::partial_order_or
pub fn partial_order_or<T: ?Sized, C>(cmp: C) -> PartialOrderOr<T, C> where
T: PartialOrd<T>,
C: Comparator<T>,
This function returns a Comparator
for T
which follows the semantics of
PartialOrd::partial_cmp
but when that returns None
it calls
the underlying Comparator
cmp
.
See at_least
and at_greatest
.
Examples
use std::cmp::Ordering; use classific::{Comparator, at_least, partial_order_or}; assert_eq!(partial_order_or(at_least(|f: &f64| f.is_nan())).cmp(&f64::NAN, &1_f64), Ordering::Less); assert_eq!(partial_order_or(at_least(|f: &f64| f.is_nan())).cmp(&f64::NAN, &f64::NAN), Ordering::Equal); assert_eq!(partial_order_or(at_least(|f: &f64| f.is_nan())).cmp(&1_f64, &f64::NAN), Ordering::Greater);