FileParser -> FileDataParser

Let the FileParser be a FileDataParser, so we have uncoupled the header
parsers from the data parsers.

This way we can make the parsing process multithreaded.
This commit is contained in:
Matthias Beyer 2015-10-28 18:57:26 +01:00
parent 1166f313a3
commit 6fa42204cb

View file

@ -123,10 +123,10 @@ pub mod file {
fn get_abbrev(&self) -> String; fn get_abbrev(&self) -> String;
} }
pub trait FileParser { pub trait FileDataParser {
fn new(header_parser: &header::FileHeaderParser) -> FileParser; fn new() -> FileDataParser;
fn read(&self, string: String) -> (header::FileHeaderData, FileData); fn read(&self, string: String) -> FileData;
fn write(&self, hdr: &header::FileHeaderData, data: &FileData) -> Result<String, ParserError>; fn write(&self, data: &FileData) -> Result<String, ParserError>;
} }
pub type HeaderDataTpl = (Option<String>, Option<String>); pub type HeaderDataTpl = (Option<String>, Option<String>);