Impl {Display,Debug} for JsonHeaderParser
This commit is contained in:
parent
e2972a527e
commit
d5af28d98d
2 changed files with 21 additions and 1 deletions
|
@ -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<String>)
|
||||
|
|
|
@ -83,7 +83,7 @@ impl Display for ParserError {
|
|||
|
||||
}
|
||||
|
||||
pub trait FileHeaderParser : Sized {
|
||||
pub trait FileHeaderParser : Sized + Debug + Display {
|
||||
fn read(&self, string: Option<String>) -> Result<FileHeaderData, ParserError>;
|
||||
fn write(&self, data: &FileHeaderData) -> Result<String, ParserError>;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue