Created constructor functions and paniced

This commit is contained in:
2022-10-06 21:09:45 +02:00
parent a22bed930a
commit 48626728e8
4 changed files with 74 additions and 9 deletions

View File

@@ -6,4 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
paste = "*"
cdtypes = {path = "../cdtypes"}
paste = "*"

View File

@@ -74,6 +74,12 @@ impl std::convert::From<std::io::Error> for Error {
}
}
impl std::convert::From<cdtypes::Error> for Error {
fn from(error: cdtypes::Error) -> Self {
Error::from_error(error)
}
}
pub fn open_output(output_file: Option<PathBuf>) -> Result<Output, Error> {
match output_file {
Some(output_path) => Ok(Box::new(std::io::BufWriter::new(std::fs::File::create(output_path)?))),