| 1 | |
| 2 |
|
| 3 | use core::cmp::Ordering;
|
| 4 |
|
| 5 | |
| 6 | |
| 7 | |
| 8 | #[cfg_attr(docsrs, doc(cfg(feature = "span-locations")))]
|
| 9 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
| 10 | pub struct LineColumn {
|
| 11 | |
| 12 | |
| 13 | pub line: usize,
|
| 14 | |
| 15 | |
| 16 | pub column: usize,
|
| 17 | }
|
| 18 |
|
| 19 | impl Ord for LineColumn {
|
| 20 | fn cmp(&self, other: &Self) -> Ordering {
|
| 21 | self.line
|
| 22 | .cmp(&other.line)
|
| 23 | .then(self.column.cmp(&other.column))
|
| 24 | }
|
| 25 | }
|
| 26 |
|
| 27 | impl PartialOrd for LineColumn {
|
| 28 | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
| 29 | Some(self.cmp(other))
|
| 30 | }
|
| 31 | }
|