Skip to content

Commit 3598d9c

Browse files
committed
Add FromZval and FromZvalMut implementations for Zval
1 parent 54c6c64 commit 3598d9c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/types/zval.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{convert::TryInto, ffi::c_void, fmt::Debug, ptr};
77
use crate::{
88
binary::Pack,
99
boxed::ZBox,
10-
convert::{FromZval, IntoZval, IntoZvalDyn},
10+
convert::{FromZval, FromZvalMut, IntoZval, IntoZvalDyn},
1111
error::{Error, Result},
1212
ffi::{
1313
_zval_struct__bindgen_ty_1, _zval_struct__bindgen_ty_2, zend_is_callable, zend_resource,
@@ -558,3 +558,19 @@ impl IntoZval for Zval {
558558
Ok(())
559559
}
560560
}
561+
562+
impl<'a> FromZval<'a> for &'a Zval {
563+
const TYPE: DataType = DataType::Mixed;
564+
565+
fn from_zval(zval: &'a Zval) -> Option<Self> {
566+
Some(zval)
567+
}
568+
}
569+
570+
impl<'a> FromZvalMut<'a> for &'a mut Zval {
571+
const TYPE: DataType = DataType::Mixed;
572+
573+
fn from_zval_mut(zval: &'a mut Zval) -> Option<Self> {
574+
Some(zval)
575+
}
576+
}

0 commit comments

Comments
 (0)