1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
pub mod app; pub use app::*; mod reader; pub use reader::Reader; mod editor; pub use editor::Editor; pub trait ForceUnwrap<T: std::fmt::Debug> { fn force_unwrap(self) -> T; } impl<T: std::fmt::Debug> ForceUnwrap<T> for Option<T> { fn force_unwrap(self) -> T { match self { Some(t) => t, None => { println!("Unexpected found none value at {:?}", self); std::process::exit(0); } } } } impl<T: std::fmt::Debug, E: std::fmt::Debug> ForceUnwrap<T> for Result<T, E> { fn force_unwrap(self) -> T { match self { Ok(t) => t, Err(e) => { println!("Unexpected found error at {:?}", e); std::process::exit(0); } } } }