diff options
Diffstat (limited to 'src/main_result.rs')
-rw-r--r-- | src/main_result.rs | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/main_result.rs b/src/main_result.rs deleted file mode 100644 index 36e3096..0000000 --- a/src/main_result.rs +++ /dev/null @@ -1,32 +0,0 @@ -use std::{ - io::{self, Write}, - process::{ExitCode, Termination}, -}; - -use super::error::Error; - -pub enum MainResult { - Success, - Failure(Error), -} - -impl Termination for MainResult { - fn report(self) -> ExitCode { - match self { - Self::Success => ExitCode::SUCCESS, - Self::Failure(e) => { - let _ = write!(io::stderr(), "{e}"); - ExitCode::FAILURE - } - } - } -} - -impl From<Result<(), Error>> for MainResult { - fn from(r: Result<(), Error>) -> Self { - match r { - Ok(()) => Self::Success, - Err(e) => Self::Failure(e), - } - } -} |