Skip to content

Commit

Permalink
feat(span): liberally derive std traits
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLostLambda committed Oct 29, 2024
1 parent d7dd002 commit d6d8a9f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::traits;
pub use miette::SourceSpan as ErrorSpan;

/// Wraps the structure to keep source code span, but also dereference to T
#[derive(Clone, Debug)]
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "minicbor", derive(minicbor::Encode, minicbor::Decode))]
pub struct Spanned<T, S> {
#[cfg_attr(feature = "minicbor", n(0))]
Expand All @@ -31,7 +31,7 @@ pub struct Spanned<T, S> {
}

/// Normal byte offset span
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "minicbor", derive(minicbor::Encode, minicbor::Decode))]
pub struct Span(
#[cfg_attr(feature = "minicbor", n(0))] pub usize,
Expand All @@ -40,7 +40,7 @@ pub struct Span(

/// Line and column position of the datum in the source code
// TODO(tailhook) optimize Eq to check only offset
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "minicbor", derive(minicbor::Encode, minicbor::Decode))]
pub struct LinePos {
/// Zero-based byte offset
Expand All @@ -55,7 +55,7 @@ pub struct LinePos {
}

/// Span with line and column number
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "minicbor", derive(minicbor::Encode, minicbor::Decode))]
pub struct LineSpan(
#[cfg_attr(feature = "minicbor", n(0))] pub LinePos,
Expand Down

0 comments on commit d6d8a9f

Please sign in to comment.