Function core::cmp::partial_min
[−]
[src]
pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T>
Deprecated since 1.3.0
: has not proven itself worthwhile
Compare and return the minimum of two values if there is one.
Returns the first argument if the comparison determines them to be equal.
Examples
#![feature(cmp_partial)] fn main() { use std::cmp; assert_eq!(Some(1), cmp::partial_min(1, 2)); assert_eq!(Some(2), cmp::partial_min(2, 2)); }#![feature(cmp_partial)] use std::cmp; assert_eq!(Some(1), cmp::partial_min(1, 2)); assert_eq!(Some(2), cmp::partial_min(2, 2));
When comparison is impossible:
#![feature(cmp_partial)] fn main() { use std::cmp; let result = cmp::partial_min(std::f64::NAN, 1.0); assert_eq!(result, None); }#![feature(cmp_partial)] use std::cmp; let result = cmp::partial_min(std::f64::NAN, 1.0); assert_eq!(result, None);