impartial-ord

Crates.ioimpartial-ord
lib.rsimpartial-ord
version1.0.6
sourcesrc
created_at2023-03-01 21:20:55.108641
updated_at2024-06-15 12:10:37.942743
descriptionDerives a quicker PartialOrd for types that already implement Ord
homepage
repositoryhttps://github.com/Alorel/impartial-ord-rs
max_upload_size
id798328
size5,275
Art (Alorel)

documentation

README

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))
    }
}
Commit count: 15

cargo fmt