From c39cb95ee902bb077b0c8cbbd0d5e1f17c7c5a4e Mon Sep 17 00:00:00 2001 From: Brooks J Rady Date: Thu, 8 Feb 2024 11:31:24 -0800 Subject: [PATCH] feat(source): allow SourceOffset and SourceSpan to be sorted --- src/protocol.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocol.rs b/src/protocol.rs index 310fc86..9f312db 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -550,7 +550,7 @@ impl<'a> SpanContents<'a> for MietteSpanContents<'a> { } /// Span within a [`SourceCode`] -#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct SourceSpan { /// The start of the span. @@ -652,7 +652,7 @@ pub type ByteOffset = usize; /** Newtype that represents the [`ByteOffset`] from the beginning of a [`SourceCode`] */ -#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct SourceOffset(ByteOffset);