diff --git a/src/storage/backend.rs b/src/storage/backend.rs index 12873509..e2cbd1c6 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -253,3 +253,18 @@ impl Display for StorageBackendError { } } + +fn write_with_parser<'a, HP>(f: &File, p: &Parser) -> Result + where HP: FileHeaderParser +{ + p.write(f.contents()) + .or_else(|err| { + let mut serr = StorageBackendError::build( + "Parser::write()", + "Cannot translate internal representation of file contents into on-disk representation", + None + ); + serr.caused_by = Some(Box::new(err)); + Err(serr) + }) +}