Crate impartial_ord
source ·Expand description
Derives a quicker PartialOrd
for types that already implement Ord
.
#[derive(impartial_ord::ImpartialOrd, Ord, PartialEq, Eq, Default, Debug)]
struct MyStruct { foo: Bar, qux: Baz, }
assert_eq!(MyStruct::default().partial_cmp(&MyStruct::default()), Some(Ordering::Equal));
§Generated output
impl PartialOrd for MyStruct where Self: Ord {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(Ord::cmp(self, other))
}
}