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 Feb 8, 2024
1 parent c44c6b0 commit 6bafa32
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::decode::Context;
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))]
Expand All @@ -42,7 +42,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 @@ -57,7 +57,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))]
Expand Down

0 comments on commit 6bafa32

Please sign in to comment.