https://github.com/alorel/impartial-ord-rs
Derives a quicker `PartialOrd` for types that already implement `Ord`
https://github.com/alorel/impartial-ord-rs
Last synced: 2 days ago
JSON representation
Derives a quicker `PartialOrd` for types that already implement `Ord`
- Host: GitHub
- URL: https://github.com/alorel/impartial-ord-rs
- Owner: Alorel
- License: mit
- Created: 2023-03-01T20:01:32.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T15:01:09.000Z (6 months ago)
- Last Synced: 2025-03-05T16:43:08.780Z (about 2 months ago)
- Language: Rust
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Derives a quicker `PartialOrd` for types that already implement `Ord`.
[](https://github.com/Alorel/impartial-ord-rs/actions/workflows/lint-n-test.yml?query=branch%3Amaster)
[](https://crates.io/crates/impartial-ord)
[](https://docs.rs/impartial-ord)
[](https://libraries.io/cargo/impartial-ord)```rust
#[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
```rust
impl PartialOrd for MyStruct where Self: Ord {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option {
Some(Ord::cmp(self, other))
}
}
````