From 51587c9f63150cfc88b05422bf501a817408be51 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 19 Jul 2023 11:06:05 +0200 Subject: [PATCH 1/2] Implement IntoZvalDyn for Zval When using call_user_func!() / Callable::try_call() it's currently not possible to use Zvals in the arguments which is unexepected. The simplest way is to add the trait to Zval's too. --- src/convert.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/convert.rs b/src/convert.rs index 878237011f..4781c5e796 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -218,3 +218,14 @@ impl IntoZvalDyn for T { Self::TYPE } } + + +impl IntoZvalDyn for Zval { + fn as_zval(&self, _persistent: bool) -> Result { + Ok(self.shallow_clone()) + } + + fn get_type(&self) -> DataType { + self.get_type() + } +} From 59bf4ae12cf28c9a35659f10c3e1c717b3e73506 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 19 Jul 2023 11:51:40 +0200 Subject: [PATCH 2/2] fmt --- src/builders/module.rs | 3 ++- src/convert.rs | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/builders/module.rs b/src/builders/module.rs index 01bc9e4eb8..ee2b219fdd 100644 --- a/src/builders/module.rs +++ b/src/builders/module.rs @@ -131,7 +131,8 @@ impl ModuleBuilder { /// This function can be useful if you need to do any final cleanup at the /// very end of a request, after all other resources have been released. For /// example, if your extension creates any persistent resources that last - /// beyond a single request, you could use this function to clean those up. # Arguments + /// beyond a single request, you could use this function to clean those up. + /// # Arguments /// /// * `func` - The function to be called when shutdown is requested. pub fn post_deactivate_function(mut self, func: extern "C" fn() -> i32) -> Self { diff --git a/src/convert.rs b/src/convert.rs index 4781c5e796..e1e2169912 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -219,7 +219,6 @@ impl IntoZvalDyn for T { } } - impl IntoZvalDyn for Zval { fn as_zval(&self, _persistent: bool) -> Result { Ok(self.shallow_clone())