Skip to content

Commit

Permalink
Impl Ord for Offset struct
Browse files Browse the repository at this point in the history
  • Loading branch information
stefnotch committed Aug 26, 2023
1 parent f10e56b commit a9b67f6
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 a9b67f6

Please sign in to comment.