diff --git a/src/main.rs b/src/main.rs index 999fd73..59a8749 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,7 +63,7 @@ struct ViewPostTemplate { markdown_access: bool, } -type AppResult = Result; +type AppResult = Result; #[derive(Error, Debug)] enum AppError { @@ -71,6 +71,13 @@ enum AppError { PostError(#[from] PostError), } +impl From for AppError { + #[inline(always)] + fn from(value: std::io::Error) -> Self { + Self::PostError(PostError::IoError(value)) + } +} + #[derive(Template)] #[template(path = "error.html")] struct ErrorTemplate {