#partial-ord #macro-derive #ord #derive #macro

macro impartial-ord

Derives a quicker PartialOrd for types that already implement Ord

7 stable releases

1.0.6 Jun 15, 2024
1.0.5 Apr 28, 2023
1.0.1 Mar 4, 2023

#1585 in Development tools

Download history 8/week @ 2024-09-21 5/week @ 2024-09-28 3/week @ 2024-10-05 59/week @ 2024-10-12 33/week @ 2024-10-19 43/week @ 2024-10-26 18/week @ 2024-11-02 157/week @ 2024-11-09 767/week @ 2024-11-16 63/week @ 2024-11-23 800/week @ 2024-11-30

1,789 downloads per month
Used in 2 crates

MIT license

6KB

Derives a quicker PartialOrd for types that already implement Ord.

Master CI badge crates.io badge docs.rs badge dependencies badge

#[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))
    }
}

Dependencies

~245–700KB
~17K SLoC