From aea6a787ab28cb21775a63828c4eff0be2b92e32 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 19 Jul 2023 11:05:16 +0200 Subject: [PATCH 1/2] Add helper for class name --- src/zend/class.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/zend/class.rs b/src/zend/class.rs index dc06a3285d..0ab3f97911 100644 --- a/src/zend/class.rs +++ b/src/zend/class.rs @@ -79,6 +79,12 @@ impl ClassEntry { Self::try_find(name.as_str().ok()?) } } + + pub fn name(&self) -> Option<&str> { + unsafe { + self.name.as_ref().and_then(|s| s.as_str().ok()) + } + } } impl PartialEq for ClassEntry { From c138e2b4e4647022e0a1ef397e1ea8ecec3e1320 Mon Sep 17 00:00:00 2001 From: Joe Hoyle Date: Wed, 19 Jul 2023 11:51:07 +0200 Subject: [PATCH 2/2] fmt --- src/builders/module.rs | 3 ++- src/zend/class.rs | 4 +--- 2 files changed, 3 insertions(+), 4 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/zend/class.rs b/src/zend/class.rs index 0ab3f97911..6e7f7961d8 100644 --- a/src/zend/class.rs +++ b/src/zend/class.rs @@ -81,9 +81,7 @@ impl ClassEntry { } pub fn name(&self) -> Option<&str> { - unsafe { - self.name.as_ref().and_then(|s| s.as_str().ok()) - } + unsafe { self.name.as_ref().and_then(|s| s.as_str().ok()) } } }