Skip to content

Commit 9c872ae

Browse files
authored
More deriving (#885)
* Enhance SimpleSpan with additional traits Added Default and PartialOrd, Ord traits to SimpleSpan. * Add PartialOrd and Ord traits to Rich struct
1 parent 7733a7f commit 9c872ae

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ where
602602
/// assert_eq!(error.found(), Some(&'5'));
603603
///
604604
/// ```
605-
#[derive(Clone, PartialEq, Eq, Hash)]
605+
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
606606
pub struct Rich<'a, T, S = SimpleSpan<usize>> {
607607
span: S,
608608
reason: Box<RichReason<'a, T>>,

src/span.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub trait Span {
8585
/// The most basic implementor of `Span` - akin to `Range`, but `Copy` since it's not also
8686
/// an iterator. Also has a `Display` implementation
8787
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
88-
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
88+
#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
8989
pub struct SimpleSpan<T = usize, C = ()> {
9090
/// The start offset of the span.
9191
pub start: T,

0 commit comments

Comments
 (0)