Struct ext_php_rs::types::ZendClassObject
source · #[repr(C)]pub struct ZendClassObject<T> {
pub obj: Option<T>,
pub std: ZendObject,
}
Expand description
Representation of a Zend class object in memory.
Fields§
§obj: Option<T>
§std: ZendObject
Implementations§
source§impl<T: RegisteredClass> ZendClassObject<T>
impl<T: RegisteredClass> ZendClassObject<T>
sourcepub fn new(val: T) -> ZBox<Self>
pub fn new(val: T) -> ZBox<Self>
Creates a new ZendClassObject
of type T
, where T
is a
RegisteredClass
in PHP, storing the given value val
inside the
object.
§Parameters
val
- The value to store inside the object.
§Panics
Panics if memory was unable to be allocated for the new object.
sourcepub unsafe fn new_uninit(ce: Option<&'static ClassEntry>) -> ZBox<Self>
pub unsafe fn new_uninit(ce: Option<&'static ClassEntry>) -> ZBox<Self>
Creates a new ZendClassObject
of type T
, with an uninitialized
internal object.
§Safety
As the object is uninitialized, the caller must ensure the following until the internal object is initialized:
- The object is never dereferenced to
T
. - The
Clone
implementation is never called. - The
Debug
implementation is never called.
If any of these conditions are not met while not initialized, the
corresponding function will panic. Converting the object into its
inner pointer with the into_raw
function is valid, however.
§Panics
Panics if memory was unable to be allocated for the new object.
sourcepub fn initialize(&mut self, val: T) -> Option<T>
pub fn initialize(&mut self, val: T) -> Option<T>
sourcepub fn from_zend_obj(std: &zend_object) -> Option<&Self>
pub fn from_zend_obj(std: &zend_object) -> Option<&Self>
Returns a mutable reference to the ZendClassObject
of a given zend
object obj
. Returns None
if the given object is not of the
type T
.
§Parameters
obj
- The zend object to get theZendClassObject
for.
sourcepub fn from_zend_obj_mut(std: &mut zend_object) -> Option<&mut Self>
pub fn from_zend_obj_mut(std: &mut zend_object) -> Option<&mut Self>
Returns a mutable reference to the ZendClassObject
of a given zend
object obj
. Returns None
if the given object is not of the
type T
.
§Parameters
obj
- The zend object to get theZendClassObject
for.
sourcepub fn get_mut_zend_obj(&mut self) -> &mut zend_object
pub fn get_mut_zend_obj(&mut self) -> &mut zend_object
Returns a mutable reference to the underlying Zend object.
Trait Implementations§
source§impl<T: Debug> Debug for ZendClassObject<T>
impl<T: Debug> Debug for ZendClassObject<T>
source§impl<T> Deref for ZendClassObject<T>
impl<T> Deref for ZendClassObject<T>
source§impl<T> DerefMut for ZendClassObject<T>
impl<T> DerefMut for ZendClassObject<T>
source§impl<'a, T: RegisteredClass> FromZendObject<'a> for &'a ZendClassObject<T>
impl<'a, T: RegisteredClass> FromZendObject<'a> for &'a ZendClassObject<T>
source§fn from_zend_object(obj: &'a ZendObject) -> Result<Self>
fn from_zend_object(obj: &'a ZendObject) -> Result<Self>
Self
from the source ZendObject
.source§impl<'a, T: RegisteredClass> FromZendObjectMut<'a> for &'a mut ZendClassObject<T>
impl<'a, T: RegisteredClass> FromZendObjectMut<'a> for &'a mut ZendClassObject<T>
source§fn from_zend_object_mut(obj: &'a mut ZendObject) -> Result<Self>
fn from_zend_object_mut(obj: &'a mut ZendObject) -> Result<Self>
Self
from the source ZendObject
.