diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml index 6d2bd563..89cb324f 100644 --- a/contrib/lib/Cargo.toml +++ b/contrib/lib/Cargo.toml @@ -33,8 +33,8 @@ serde_json = { version = "1.0", optional = true } rmp-serde = { version = "^0.13", optional = true } # Templating dependencies only. -handlebars = { version = "0.32", optional = true } -glob = { version = "^0.2", optional = true } +handlebars = { version = "1.0", optional = true } +glob = { version = "0.2", optional = true } tera = { version = "0.11", optional = true } [dev-dependencies] diff --git a/examples/handlebars_templates/src/main.rs b/examples/handlebars_templates/src/main.rs index 84116830..49938af6 100644 --- a/examples/handlebars_templates/src/main.rs +++ b/examples/handlebars_templates/src/main.rs @@ -11,7 +11,7 @@ use rocket::Request; use rocket::response::Redirect; use rocket_contrib::{Template, handlebars}; -use handlebars::{Helper, Handlebars, RenderContext, RenderError, JsonRender}; +use handlebars::{Helper, Handlebars, Context, RenderContext, Output, HelperResult, JsonRender}; #[derive(Serialize)] struct TemplateContext { @@ -54,9 +54,17 @@ fn not_found(req: &Request) -> Template { Template::render("error/404", &map) } -fn wow_helper(h: &Helper, _: &Handlebars, rc: &mut RenderContext) -> Result<(), RenderError> { +fn wow_helper( + h: &Helper, + _: &Handlebars, + _: &Context, + _: &mut RenderContext, + out: &mut Output +) -> HelperResult { if let Some(param) = h.param(0) { - write!(rc.writer, "{}", param.value().render())?; + out.write("")?; + out.write(¶m.value().render())?; + out.write("")?; } Ok(())