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

View file

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

View file

@ -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)
}
}