feat(source): allow SourceOffset and SourceSpan to be sorted

This commit is contained in:
Brooks J Rady 2024-02-08 11:31:24 -08:00
parent ad42459baf
commit c39cb95ee9
1 changed files with 2 additions and 2 deletions

View File

@ -550,7 +550,7 @@ impl<'a> SpanContents<'a> for MietteSpanContents<'a> {
} }
/// Span within a [`SourceCode`] /// 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))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct SourceSpan { pub struct SourceSpan {
/// The start of the span. /// The start of the span.
@ -652,7 +652,7 @@ pub type ByteOffset = usize;
/** /**
Newtype that represents the [`ByteOffset`] from the beginning of a [`SourceCode`] 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))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct SourceOffset(ByteOffset); pub struct SourceOffset(ByteOffset);