From bbad427079188519ef81dee7acb067da8558182c Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Sun, 7 Jun 2020 13:55:44 +0800 Subject: [PATCH] Update 'handlebars' to 3.0. --- contrib/lib/Cargo.toml | 2 +- contrib/lib/src/templates/engine.rs | 4 ++-- contrib/lib/src/templates/handlebars_templates.rs | 4 ++-- examples/handlebars_templates/src/main.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/lib/Cargo.toml b/contrib/lib/Cargo.toml index 2af02c39..40a12e55 100644 --- a/contrib/lib/Cargo.toml +++ b/contrib/lib/Cargo.toml @@ -52,7 +52,7 @@ serde_json = { version = "1.0.26", optional = true } rmp-serde = { version = "0.14.0", optional = true } # Templating dependencies. -handlebars = { version = "2.0", optional = true } +handlebars = { version = "3.0", optional = true } glob = { version = "0.3", optional = true } tera = { version = "1.0.2", optional = true } notify = { version = "4.0.6", optional = true } diff --git a/contrib/lib/src/templates/engine.rs b/contrib/lib/src/templates/engine.rs index c5c9f199..fdcf4172 100644 --- a/contrib/lib/src/templates/engine.rs +++ b/contrib/lib/src/templates/engine.rs @@ -62,7 +62,7 @@ pub struct Engines { /// `Tera` instance, ensure you use types imported from /// `rocket_contrib::templates::handlebars` to avoid version mismatches. #[cfg(feature = "handlebars_templates")] - pub handlebars: Handlebars, + pub handlebars: Handlebars<'static>, } impl Engines { @@ -88,7 +88,7 @@ impl Engines { None => return None }, #[cfg(feature = "handlebars_templates")] - handlebars: match inner::(templates) { + handlebars: match inner::>(templates) { Some(hb) => hb, None => return None }, diff --git a/contrib/lib/src/templates/handlebars_templates.rs b/contrib/lib/src/templates/handlebars_templates.rs index 8220639f..9d667c76 100644 --- a/contrib/lib/src/templates/handlebars_templates.rs +++ b/contrib/lib/src/templates/handlebars_templates.rs @@ -4,10 +4,10 @@ use crate::templates::{Engine, TemplateInfo}; pub use crate::templates::handlebars::Handlebars; -impl Engine for Handlebars { +impl Engine for Handlebars<'static> { const EXT: &'static str = "hbs"; - fn init(templates: &[(&str, &TemplateInfo)]) -> Option { + fn init(templates: &[(&str, &TemplateInfo)]) -> Option> { let mut hb = Handlebars::new(); for &(name, info) in templates { let path = &info.path; diff --git a/examples/handlebars_templates/src/main.rs b/examples/handlebars_templates/src/main.rs index 829940f9..e2b29535 100644 --- a/examples/handlebars_templates/src/main.rs +++ b/examples/handlebars_templates/src/main.rs @@ -56,7 +56,7 @@ fn wow_helper( h: &Helper<'_, '_>, _: &Handlebars, _: &Context, - _: &mut RenderContext<'_>, + _: &mut RenderContext<'_, '_>, out: &mut dyn Output ) -> HelperResult { if let Some(param) = h.param(0) {