1
0
Fork 0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-05-24 01:36:04 +02:00
kiln/src/result.rs
2019-05-18 14:00:12 -04:00

22 lines
473 B
Rust

use std::{error, fmt, result};
pub type Result<T> = result::Result<T, Error>;
pub type Error = Box<dyn error::Error>;
pub type Exit = result::Result<(), Display<Error>>;
pub struct Display<T: fmt::Display>(T);
impl<T: fmt::Display> fmt::Debug for Display<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0)
}
}
impl<T: fmt::Display> From<T> for Display<T> {
fn from(t: T) -> Display<T> {
Display(t)
}
}