Skip to content

Commit 7b35476

Browse files
authored
Implement IntoZvalDyn for Zval (#256)
1 parent 5d1ffce commit 7b35476

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/builders/module.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ impl ModuleBuilder {
131131
/// This function can be useful if you need to do any final cleanup at the
132132
/// very end of a request, after all other resources have been released. For
133133
/// example, if your extension creates any persistent resources that last
134-
/// beyond a single request, you could use this function to clean those up. # Arguments
134+
/// beyond a single request, you could use this function to clean those up.
135+
/// # Arguments
135136
///
136137
/// * `func` - The function to be called when shutdown is requested.
137138
pub fn post_deactivate_function(mut self, func: extern "C" fn() -> i32) -> Self {

src/convert.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,13 @@ impl<T: IntoZval + Clone> IntoZvalDyn for T {
218218
Self::TYPE
219219
}
220220
}
221+
222+
impl IntoZvalDyn for Zval {
223+
fn as_zval(&self, _persistent: bool) -> Result<Zval> {
224+
Ok(self.shallow_clone())
225+
}
226+
227+
fn get_type(&self) -> DataType {
228+
self.get_type()
229+
}
230+
}

0 commit comments

Comments
 (0)