Skip to main content

oxilean_std/prod/
lexpair_traits.rs

1//! # LexPair - Trait Implementations
2//!
3//! This module contains trait implementations for `LexPair`.
4//!
5//! ## Implemented Traits
6//!
7//! - `PartialOrd`
8//! - `Ord`
9//!
10//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
11
12use super::types::LexPair;
13
14impl<A: Ord, B: Ord> PartialOrd for LexPair<A, B> {
15    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
16        Some(self.cmp(other))
17    }
18}
19
20impl<A: Ord, B: Ord> Ord for LexPair<A, B> {
21    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
22        match self.fst.cmp(&other.fst) {
23            std::cmp::Ordering::Equal => self.snd.cmp(&other.snd),
24            ord => ord,
25        }
26    }
27}