pub struct ZVal { /* private fields */ }
Expand description
Wrapper of zval.
Implementations§
Source§impl ZVal
impl ZVal
Sourcepub unsafe fn try_from_ptr<'a>(ptr: *const zval) -> Option<&'a Self>
pub unsafe fn try_from_ptr<'a>(ptr: *const zval) -> Option<&'a Self>
Sourcepub unsafe fn from_mut_ptr<'a>(ptr: *mut zval) -> &'a mut Self
pub unsafe fn from_mut_ptr<'a>(ptr: *mut zval) -> &'a mut Self
Sourcepub unsafe fn try_from_mut_ptr<'a>(ptr: *mut zval) -> Option<&'a mut Self>
pub unsafe fn try_from_mut_ptr<'a>(ptr: *mut zval) -> Option<&'a mut Self>
Sourcepub fn as_mut_ptr(&mut self) -> *mut zval
pub fn as_mut_ptr(&mut self) -> *mut zval
Returns a raw pointer wrapped.
Sourcepub fn into_inner(self) -> zval
pub fn into_inner(self) -> zval
Consumes the ZVal
, returning the wrapped zval
.
Sourcepub fn get_type_info(&self) -> TypeInfo
pub fn get_type_info(&self) -> TypeInfo
Gets the type info of ZVal
.
Sourcepub fn expect_null(&self) -> Result<()>
pub fn expect_null(&self) -> Result<()>
Converts to null if ZVal
is null, otherwise returns
ExpectTypeError
.
Sourcepub fn expect_bool(&self) -> Result<bool>
pub fn expect_bool(&self) -> Result<bool>
Converts to bool if ZVal
is bool, otherwise returns
ExpectTypeError
.
Sourcepub fn expect_long(&self) -> Result<i64>
pub fn expect_long(&self) -> Result<i64>
Converts to long if ZVal
is long, otherwise returns
ExpectTypeError
.
Sourcepub fn as_mut_long(&mut self) -> Option<&mut i64>
pub fn as_mut_long(&mut self) -> Option<&mut i64>
Converts to mutable long if ZVal
is long.
§Examples
use phper::values::ZVal;
let mut val = ZVal::from(100);
*val.as_mut_long().unwrap() += 100;
assert_eq!(val.as_long().unwrap(), 200);
Sourcepub fn expect_mut_long(&mut self) -> Result<&mut i64>
pub fn expect_mut_long(&mut self) -> Result<&mut i64>
Converts to mutable long if ZVal
is long, otherwise returns
ExpectTypeError
.
§Examples
use phper::values::ZVal;
let mut val = ZVal::from(100);
*val.expect_mut_long().unwrap() += 100;
assert_eq!(val.expect_long().unwrap(), 200);
Sourcepub fn expect_double(&self) -> Result<f64>
pub fn expect_double(&self) -> Result<f64>
Converts to double if ZVal
is double, otherwise returns
ExpectTypeError
.
Sourcepub fn as_mut_double(&mut self) -> Option<&mut f64>
pub fn as_mut_double(&mut self) -> Option<&mut f64>
Converts to mutable double if ZVal
is double.
Sourcepub fn expect_mut_double(&mut self) -> Result<&mut f64>
pub fn expect_mut_double(&mut self) -> Result<&mut f64>
Converts to mutable double if ZVal
is double, otherwise returns
ExpectTypeError
.
Sourcepub fn expect_z_str(&self) -> Result<&ZStr>
pub fn expect_z_str(&self) -> Result<&ZStr>
Converts to string if ZVal
is string, otherwise returns
ExpectTypeError
.
Sourcepub fn as_mut_z_str(&mut self) -> Option<&mut ZStr>
pub fn as_mut_z_str(&mut self) -> Option<&mut ZStr>
Converts to mutable string if ZVal
is string.
Sourcepub fn expect_mut_z_str(&mut self) -> Result<&mut ZStr>
pub fn expect_mut_z_str(&mut self) -> Result<&mut ZStr>
Converts to mutable string if ZVal
is string, otherwise returns
ExpectTypeError
.
Sourcepub fn expect_z_arr(&self) -> Result<&ZArr>
pub fn expect_z_arr(&self) -> Result<&ZArr>
Converts to array if ZVal
is array, otherwise returns
ExpectTypeError
.
Sourcepub fn as_mut_z_arr(&mut self) -> Option<&mut ZArr>
pub fn as_mut_z_arr(&mut self) -> Option<&mut ZArr>
Converts to mutable array if ZVal
is array.
Sourcepub fn expect_mut_z_arr(&mut self) -> Result<&mut ZArr>
pub fn expect_mut_z_arr(&mut self) -> Result<&mut ZArr>
Converts to mutable array if ZVal
is array, otherwise returns
ExpectTypeError
.
Sourcepub fn expect_z_obj(&self) -> Result<&ZObj>
pub fn expect_z_obj(&self) -> Result<&ZObj>
Converts to object if ZVal
is object, otherwise returns
ExpectTypeError
.
Sourcepub fn as_mut_z_obj(&mut self) -> Option<&mut ZObj>
pub fn as_mut_z_obj(&mut self) -> Option<&mut ZObj>
Converts to mutable object if ZVal
is object.
Sourcepub fn expect_mut_z_obj(&mut self) -> Result<&mut ZObj>
pub fn expect_mut_z_obj(&mut self) -> Result<&mut ZObj>
Converts to mutable object if ZVal
is object, otherwise returns
ExpectTypeError
.
Sourcepub fn expect_z_res(&self) -> Result<&ZRes>
pub fn expect_z_res(&self) -> Result<&ZRes>
Converts to resource if ZVal
is resource, otherwise returns
ExpectTypeError
.
Sourcepub fn as_mut_z_res(&mut self) -> Option<&mut ZRes>
pub fn as_mut_z_res(&mut self) -> Option<&mut ZRes>
Converts to mutable resource if ZVal
is null.
Sourcepub fn expect_mut_z_res(&mut self) -> Result<&mut ZRes>
pub fn expect_mut_z_res(&mut self) -> Result<&mut ZRes>
Converts to mutable resource if ZVal
is resource, otherwise returns
ExpectTypeError
.
Sourcepub fn expect_z_ref(&self) -> Result<&ZRef>
pub fn expect_z_ref(&self) -> Result<&ZRef>
Converts to reference if ZVal
is reference, otherwise returns
ExpectTypeError
.
Sourcepub fn as_mut_z_ref(&mut self) -> Option<&mut ZRef>
pub fn as_mut_z_ref(&mut self) -> Option<&mut ZRef>
Converts to mutable reference if ZVal
is reference.
Sourcepub fn expect_mut_z_ref(&mut self) -> Result<&mut ZRef>
pub fn expect_mut_z_ref(&mut self) -> Result<&mut ZRef>
Converts to mutable reference if ZVal
is reference, otherwise returns
ExpectTypeError
.
Sourcepub fn convert_to_long(&mut self)
pub fn convert_to_long(&mut self)
Internally convert to long.
TODO To fix assertion failed.
Sourcepub fn convert_to_string(&mut self)
pub fn convert_to_string(&mut self)
Internally convert to string.
TODO To fix assertion failed.