Box Handlebars template error

See https://github.com/azerupi/mdBook/pull/466#issuecomment-335450110
This commit is contained in:
Jacob Wahlgren 2017-10-12 21:50:33 +02:00
parent c64384abc3
commit 56cee872e8
1 changed files with 8 additions and 1 deletions

View File

@ -105,7 +105,7 @@ pub mod errors {
foreign_links {
Io(::std::io::Error);
HandlebarsRender(::handlebars::RenderError);
HandlebarsTemplate(::handlebars::TemplateError);
HandlebarsTemplate(Box<::handlebars::TemplateError>);
Utf8(::std::string::FromUtf8Error);
}
@ -116,4 +116,11 @@ pub mod errors {
}
}
}
// Box to halve the size of Error
impl From<::handlebars::TemplateError> for Error {
fn from(e: ::handlebars::TemplateError) -> Error {
From::from(Box::new(e))
}
}
}