mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 01:13:08 +00:00
Use std::result::Result
This commit is contained in:
parent
fc79cc068b
commit
b40c19d8f8
|
@ -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")?;
|
||||||
|
|
|
@ -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)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue