Skip to content

Commit

Permalink
Merge pull request #511 from stefnotch/ord-offset
Browse files Browse the repository at this point in the history
Implement Ord for Offset struct
  • Loading branch information
zesterer authored Aug 27, 2023
2 parents f10e56b + a9b67f6 commit 2135b55
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,12 +935,24 @@ impl<'a, 'parse, I: Input<'a>> Clone for Offset<'a, 'parse, I> {
}
}

impl<'a, 'parse, I: Input<'a>> Eq for Offset<'a, 'parse, I> {}
impl<'a, 'parse, I: Input<'a>> PartialEq for Offset<'a, 'parse, I> {
fn eq(&self, other: &Self) -> bool {
self.offset == other.offset
}
}

impl<'a, 'parse, I: Input<'a>> PartialOrd for Offset<'a, 'parse, I> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl<'a, 'parse, I: Input<'a>> Ord for Offset<'a, 'parse, I> {
fn cmp(&self, other: &Self) -> Ordering {
self.offset.cmp(&other.offset)
}
}

pub(crate) struct Errors<T, E> {
pub(crate) alt: Option<Located<T, E>>,
pub(crate) secondary: Vec<Located<T, E>>,
Expand Down

0 comments on commit 2135b55

Please sign in to comment.