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
318,090 downloads per month
Used in 45 crates
(3 directly)
6KB
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))
}
}
Dependencies
~95–440KB
~10K SLoC