diff --git a/src/main.rs b/src/main.rs index 70e0ce03..b9129280 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ #[macro_use] extern crate clap; #[macro_use] extern crate log; +#[macro_use] extern crate serde_json; extern crate config; extern crate regex; diff --git a/src/storage/json/mod.rs b/src/storage/json/mod.rs new file mode 100644 index 00000000..67c567fa --- /dev/null +++ b/src/storage/json/mod.rs @@ -0,0 +1 @@ +pub mod parser; diff --git a/src/storage/json/parser.rs b/src/storage/json/parser.rs new file mode 100644 index 00000000..0e275ca3 --- /dev/null +++ b/src/storage/json/parser.rs @@ -0,0 +1,30 @@ +use serde_json::Value; + +use super::parser; + +struct JsonHeaderParser { + spec: &FileHeaderSpec, +} + +impl FileHeaderParser for JsonHeaderParser { + + fn new(spec: &FileHeaderSpec) -> JsonHeaderParser { + JsonHeaderParser { + spec: spec + } + } + + fn read(&self, string: Option) + -> Result + { + if let Ok(content) = data = serde_json::from_str(&string[..]) { + } else { + ParserError::short("Unknown JSON parser error", string.clone(), 0) + } + } + + fn write(&self, data: &FileHeaderData) -> Result { + } + +} + diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 5a17befe..252f6001 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -7,3 +7,5 @@ pub use runtime::Runtime; pub mod file; pub mod parser; +pub mod json; +