#macro-derive #partial-ord #ord

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

#2395 in Procedural macros

Download history 49606/week @ 2026-02-17 50749/week @ 2026-02-24 36824/week @ 2026-03-03 51189/week @ 2026-03-10 56891/week @ 2026-03-17 58665/week @ 2026-03-24 41072/week @ 2026-03-31 59828/week @ 2026-04-07 56056/week @ 2026-04-14 39721/week @ 2026-04-21 73622/week @ 2026-04-28 58724/week @ 2026-05-05 69536/week @ 2026-05-12 67897/week @ 2026-05-19 68471/week @ 2026-05-26 100159/week @ 2026-06-02

318,090 downloads per month
Used in 45 crates (3 directly)

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

~95–440KB
~10K SLoC