Implement IntoZvalDyn for Zval (#256)

This commit is contained in:
Joe Hoyle 2023-07-19 13:06:10 +02:00 committed by GitHub
parent 5d1ffcec05
commit 7b35476d04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

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

View File

@ -218,3 +218,13 @@ impl<T: IntoZval + Clone> IntoZvalDyn for T {
Self::TYPE
}
}
impl IntoZvalDyn for Zval {
fn as_zval(&self, _persistent: bool) -> Result<Zval> {
Ok(self.shallow_clone())
}
fn get_type(&self) -> DataType {
self.get_type()
}
}