From 94a0819fe3a0d679c3042a77bfe6a2afc505daea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:28 +0200 Subject: Adding upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/handlebars/src/macros.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'vendor/handlebars/src/macros.rs') diff --git a/vendor/handlebars/src/macros.rs b/vendor/handlebars/src/macros.rs index 14cb0152c..bd1eab0bb 100644 --- a/vendor/handlebars/src/macros.rs +++ b/vendor/handlebars/src/macros.rs @@ -38,7 +38,7 @@ #[macro_export] macro_rules! handlebars_helper { - ($struct_name:ident: |$($name:ident: $tpe:tt),* + ($struct_name:ident: |$($name:ident: $tpe:tt$(<$($gen:ty),+>)?),* $($(,)?{$($hash_name:ident: $hash_tpe:tt=$dft_val:literal),*})? $($(,)?*$args:ident)? $($(,)?**$kwargs:ident)?| @@ -71,11 +71,11 @@ macro_rules! handlebars_helper { stringify!($struct_name), stringify!($name), ))) .and_then(|x| - handlebars_helper!(@as_json_value x, $tpe) + handlebars_helper!(@as_json_value x, $tpe$(<$($gen),+>)?) .ok_or_else(|| $crate::RenderError::new(&format!( "`{}` helper: Couldn't convert parameter {} to type `{}`. \ It's {:?} as JSON. Got these params: {:?}", - stringify!($struct_name), stringify!($name), stringify!($tpe), + stringify!($struct_name), stringify!($name), stringify!($tpe$(<$($gen),+>)?), x, h.params(), ))) )?; @@ -117,6 +117,7 @@ macro_rules! handlebars_helper { (@as_json_value $x:ident, bool) => { $x.as_bool() }; (@as_json_value $x:ident, null) => { $x.as_null() }; (@as_json_value $x:ident, Json) => { Some($x) }; + (@as_json_value $x:ident, $tpe:tt$(<$($gen:ty),+>)?) => { serde_json::from_value::<$tpe$(<$($gen),+>)?>($x.clone()).ok() }; } #[cfg(feature = "no_logging")] -- cgit v1.2.3