cmporder 0.1.0

macros for prioritized Ord/PartialOrd
Documentation
# CmpOrder


Simple Macros to implement **prioritized `Ord`/`PartialOrd`**

## Examples


### `cmp_order`


```rust
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

struct ABC {
    a: u8,
    b: u8,
}

impl Ord for ABC {
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        // priority:
        // 1) self.a.cmp(&other.a)
        // 2) self.b.cmp(&other.b)
        cmp_order!(self.a.cmp(&other.a), self.b.cmp(&other.b))
    }
}

impl PartialOrd for ABC {
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
```

### `partial_cmp_order`


```rust
impl PartialOrd for ABC {
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        // priority:
        // 1) self.a.partial_cmp(&other.a)
        // 2) self.b.partial_cmp(&other.b)
        partial_cmp_order!(self.a.partial_cmp(&other.a), self.b.partial_cmp(&other.b))
    }
}
```