#[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>

source

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.

source

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.

source

pub fn initialize(&mut self, val: T) -> Option<T>

Initializes the class object with the value val.

§Parameters
  • val - The value to initialize the object with.
§Returns

Returns the old value in an Option if the object had already been initialized, None otherwise.

source

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
source

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
source

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>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Deref for ZendClassObject<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> DerefMut for ZendClassObject<T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a, T: RegisteredClass> FromZendObject<'a> for &'a ZendClassObject<T>

source§

fn from_zend_object(obj: &'a ZendObject) -> Result<Self>

Extracts Self from the source ZendObject.
source§

impl<'a, T: RegisteredClass> FromZendObjectMut<'a> for &'a mut ZendClassObject<T>

source§

fn from_zend_object_mut(obj: &'a mut ZendObject) -> Result<Self>

Extracts Self from the source ZendObject.
source§

impl<'a, T: RegisteredClass> FromZval<'a> for &'a ZendClassObject<T>

source§

const TYPE: DataType = _

The corresponding type of the implemented value in PHP.
source§

fn from_zval(zval: &'a Zval) -> Option<Self>

Attempts to retrieve an instance of Self from a reference to a Zval. Read more
source§

impl<'a, T: RegisteredClass> FromZvalMut<'a> for &'a mut ZendClassObject<T>

source§

const TYPE: DataType = _

The corresponding type of the implemented value in PHP.
source§

fn from_zval_mut(zval: &'a mut Zval) -> Option<Self>

Attempts to retrieve an instance of Self from a mutable reference to a Zval. Read more
source§

impl<T: RegisteredClass> IntoZval for &mut ZendClassObject<T>

source§

const TYPE: DataType = _

The corresponding type of the implemented value in PHP.
source§

fn set_zval(self, zv: &mut Zval, _: bool) -> Result<()>

Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful. Read more
source§

fn into_zval(self, persistent: bool) -> Result<Zval>

Converts a Rust primitive type into a Zval. Returns a result containing the Zval if successful. Read more
source§

impl<T: RegisteredClass> ZBoxable for ZendClassObject<T>

source§

fn free(&mut self)

Frees the memory pointed to by self, calling any destructors required in the process.

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for ZendClassObject<T>
where T: RefUnwindSafe,

§

impl<T> !Send for ZendClassObject<T>

§

impl<T> !Sync for ZendClassObject<T>

§

impl<T> Unpin for ZendClassObject<T>
where T: Unpin,

§

impl<T> UnwindSafe for ZendClassObject<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.