use std::process::{ExitCode, Termination}; use crate::How; pub enum TerminationResult { Ok, Err(How), } impl Termination for TerminationResult { fn report(self) -> ExitCode { match self { Self::Ok => ExitCode::SUCCESS, Self::Err(e) => { use std::io::Write; let _ = writeln!(std::io::stderr(), "{e}"); ExitCode::FAILURE } } } } impl From> for TerminationResult { fn from(value: Result<(), How>) -> Self { match value { Ok(()) => Self::Ok, Err(e) => Self::Err(e), } } }