Update 'handlebars' to 3.0.

This commit is contained in:
Ning Sun 2020-06-07 13:55:44 +08:00 committed by Sergio Benitez
parent c19365dcbe
commit bbad427079
4 changed files with 6 additions and 6 deletions

View File

@ -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 }

View File

@ -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::<Handlebars>(templates) {
handlebars: match inner::<Handlebars<'static>>(templates) {
Some(hb) => hb,
None => return None
},

View File

@ -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<Handlebars> {
fn init(templates: &[(&str, &TemplateInfo)]) -> Option<Handlebars<'static>> {
let mut hb = Handlebars::new();
for &(name, info) in templates {
let path = &info.path;

View File

@ -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) {