From 277f2d2176f5e98305870f90b16af3feae1bb3d1 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 18 Jan 2020 15:58:36 +0100 Subject: =?UTF-8?q?ColorToken=20serialization=20+=20function=20fix=20?= =?UTF-8?q?=F0=9F=9A=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/span.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/syntax/span.rs') diff --git a/src/syntax/span.rs b/src/syntax/span.rs index 546b3ad6..df9a3520 100644 --- a/src/syntax/span.rs +++ b/src/syntax/span.rs @@ -1,10 +1,11 @@ //! Spans map elements to the part of source code they originate from. use std::fmt::{self, Debug, Display, Formatter}; +use serde::Serialize; /// Annotates a value with the part of the source code it corresponds to. -#[derive(Copy, Clone, Eq, PartialEq, Hash)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize)] pub struct Spanned { pub v: T, pub span: Span, @@ -45,7 +46,7 @@ impl Debug for Spanned where T: std::fmt::Debug { } /// Describes a slice of source code. -#[derive(Copy, Clone, Eq, PartialEq, Hash)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize)] pub struct Span { pub start: Position, pub end: Position, @@ -83,7 +84,7 @@ impl Display for Span { debug_display!(Span); /// A line-column position in source code. -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize)] pub struct Position { /// The 0-indexed line (inclusive). pub line: usize, -- cgit v1.2.3