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

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.

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.

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.

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

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

Returns a mutable reference to the underlying Zend object.

Trait Implementations§

Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Extracts Self from the source ZendObject.
Extracts Self from the source ZendObject.
The corresponding type of the implemented value in PHP.
Attempts to retrieve an instance of Self from a reference to a Zval. Read more
The corresponding type of the implemented value in PHP.
Attempts to retrieve an instance of Self from a mutable reference to a Zval. Read more
The corresponding type of the implemented value in PHP.
Sets the content of a pre-existing zval. Returns a result containing nothing if setting the content was successful. Read more
Converts a Rust primitive type into a Zval. Returns a result containing the Zval if successful. Read more
Frees the memory pointed to by self, calling any destructors required in the process. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.