Struct fmt_cmp::cmp::Cmp [−][src]
Expand description
A wrapper type that compares the inner value in its Display
representation.
This implements Eq
, Ord
and Hash
traits with eq
, cmp
and hash
functions.
Example
Wrapping !FmtOrd
types:
assert_eq!(fmt_cmp::Cmp(f64::NAN), fmt_cmp::Cmp(f64::NAN));
assert!(fmt_cmp::Cmp(42) > fmt_cmp::Cmp(240));
Sorting integers lexicographically:
use std::collections::BTreeSet;
let mut values: BTreeSet<fmt_cmp::Cmp<u32>> = (1..=10).map(fmt_cmp::Cmp).collect();
assert!(values
.into_iter()
.map(|cmp| cmp.0)
.eq([1, 10, 2, 3, 4, 5, 6, 7, 8, 9]));
Tuple Fields
0: T
Implementations
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for Cmp<T> where
T: RefUnwindSafe,
impl<T: ?Sized> UnwindSafe for Cmp<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more