#[repr(C)]
pub struct _zend_object { pub gc: zend_refcounted_h, pub handle: u32, pub ce: *mut zend_class_entry, pub handlers: *const zend_object_handlers, pub properties: *mut HashTable, pub properties_table: [zval; 1], }

Fields§

§gc: zend_refcounted_h§handle: u32§ce: *mut zend_class_entry§handlers: *const zend_object_handlers§properties: *mut HashTable§properties_table: [zval; 1]

Implementations§

Creates a new ZendObject, returned inside an ZBox<ZendObject> wrapper.

Parameters
  • ce - The type of class the new object should be an instance of.
Panics

Panics when allocating memory for the new object fails.

Creates a new stdClass instance, returned inside an ZBox<ZendObject> wrapper.

Panics

Panics if allocating memory for the object fails, or if the stdClass class entry has not been registered with PHP yet.

Example
use ext_php_rs::types::ZendObject;

let mut obj = ZendObject::new_stdclass();

obj.set_property("hello", "world");

Converts a class object into an owned ZendObject. This removes any possibility of accessing the underlying attached Rust struct.

source

pub fn get_class_entry(&self) -> &'static ClassEntry

Returns the ClassEntry associated with this object.

Panics

Panics if the class entry is invalid.

Attempts to retrieve the class name of the object.

Returns whether this object is an instance of the given ClassEntry.

This method checks the class and interface inheritance chain.

Panics

Panics if the class entry is invalid.

Checks if the given object is an instance of a registered class with Rust type T.

This method doesn’t check the class and interface inheritance chain.

Attempts to read a property from the Object. Returns a result containing the value of the property if it exists and can be read, and an Error otherwise.

Parameters
  • name - The name of the property.
  • query - The type of query to use when attempting to get a property.

Attempts to set a property on the object.

Parameters
  • name - The name of the property.
  • value - The value to set the property to.

Checks if a property exists on an object. Takes a property name and query parameter, which defines what classifies if a property exists or not. See PropertyQuery for more information.

Parameters
  • name - The name of the property.
  • query - The ‘query’ to classify if a property exists.

Attempts to retrieve the properties of the object. Returned inside a Zend Hashtable.

Extracts some type from a Zend object.

This is a wrapper function around FromZendObject::extract().

Returns an unique identifier for the object.

The id is guaranteed to be unique for the lifetime of the object. Once the object is destroyed, it may be reused for other objects. This is equivalent to calling the spl_object_id PHP function.

Computes an unique hash for the object.

The hash is guaranteed to be unique for the lifetime of the object. Once the object is destroyed, it may be reused for other objects. This is equivalent to calling the spl_object_hash PHP function.

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.