1
0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-11-08 10:09:18 +01:00

Use std::result::Result

This commit is contained in:
adnano 2020-05-08 03:37:10 -04:00
parent fc79cc068b
commit b40c19d8f8
2 changed files with 3 additions and 23 deletions

@ -4,11 +4,12 @@ mod page;
mod result;
mod section;
use std::error::Error;
use index::Index;
use manipulate::manipulate;
pub use result::{Exit, Result};
fn main() -> Result<()> {
fn main() -> Result<T, Box<dyn Error>> {
let mut index = Index::from("src")?;
manipulate(&mut index)?;
index.write("public")?;

@ -1,21 +0,0 @@
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)
}
}