diff --git a/src/storage/json/parser.rs b/src/storage/json/parser.rs index c752e20a..7011b6c2 100644 --- a/src/storage/json/parser.rs +++ b/src/storage/json/parser.rs @@ -1,5 +1,7 @@ use std::collections::HashMap; use std::error::Error; +use std::fmt::{Debug, Display, Formatter}; +use std::fmt; use serde_json::{Value, from_str}; use serde_json::error::Result as R; @@ -25,6 +27,24 @@ impl JsonHeaderParser { } +impl Display for JsonHeaderParser { + + fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { + write!(fmt, "JsonHeaderParser"); + Ok(()) + } + +} + +impl Debug for JsonHeaderParser { + + fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { + write!(fmt, "JsonHeaderParser, Spec: {:?}", self.spec); + Ok(()) + } + +} + impl FileHeaderParser for JsonHeaderParser { fn read(&self, string: Option) diff --git a/src/storage/parser.rs b/src/storage/parser.rs index a3bbf832..3c343623 100644 --- a/src/storage/parser.rs +++ b/src/storage/parser.rs @@ -83,7 +83,7 @@ impl Display for ParserError { } -pub trait FileHeaderParser : Sized { +pub trait FileHeaderParser : Sized + Debug + Display { fn read(&self, string: Option) -> Result; fn write(&self, data: &FileHeaderData) -> Result; } @@ -164,3 +164,14 @@ impl Parser { } +impl Debug for Parser + where HP: FileHeaderParser +{ + + fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { + write!(fmt, "Parser<{:?}>", self.headerp); + + Ok(()) + } + +}