#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

#2721 in Development tools

Download history 80/week @ 2024-10-14 37/week @ 2024-10-21 22/week @ 2024-10-28 17/week @ 2024-11-04 159/week @ 2024-11-11 775/week @ 2024-11-18 57/week @ 2024-11-25 798/week @ 2024-12-02 181/week @ 2024-12-09 217/week @ 2024-12-16 37/week @ 2024-12-23 699/week @ 2024-12-30 525/week @ 2025-01-06 444/week @ 2025-01-13 1620/week @ 2025-01-20 869/week @ 2025-01-27

3,481 downloads per month
Used in 3 crates (2 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

~235–680KB
~16K SLoC