pub struct ClassMetadata<T: 'static> { /* private fields */ }Expand description
Stores the class entry, handlers, and property descriptors for a Rust type which has been exported to PHP. Usually allocated statically.
Implementations§
Source§impl<T: 'static> ClassMetadata<T>
impl<T: 'static> ClassMetadata<T>
Source§impl<T: RegisteredClass> ClassMetadata<T>
impl<T: RegisteredClass> ClassMetadata<T>
Sourcepub fn handlers(&self) -> &ZendObjectHandlers
pub fn handlers(&self) -> &ZendObjectHandlers
Returns an immutable reference to the object handlers contained inside the class metadata.
Sourcepub fn ce(&self) -> &'static ClassEntry
pub fn ce(&self) -> &'static ClassEntry
Retrieves a reference to the stored class entry.
§Panics
Panics if there is no class entry stored inside the class metadata.
Sourcepub fn set_ce(&self, ce: &'static mut ClassEntry)
pub fn set_ce(&self, ce: &'static mut ClassEntry)
Stores a reference to a class entry inside the class metadata.
§Panics
Panics if the class entry has already been set in the class metadata. This function should only be called once.
Sourcepub fn find_property(&self, name: &str) -> Option<&PropertyDescriptor<T>>
pub fn find_property(&self, name: &str) -> Option<&PropertyDescriptor<T>>
Finds a property descriptor by name.
Checks field properties first, then method properties. Linear scan is used since typical PHP classes have few properties and cache locality beats hashing at small N.
Sourcepub fn field_properties(&self) -> &'static [PropertyDescriptor<T>]
pub fn field_properties(&self) -> &'static [PropertyDescriptor<T>]
Returns the field properties (from #[php(prop)] struct fields).
Sourcepub fn method_properties(&self) -> &'static [PropertyDescriptor<T>]
pub fn method_properties(&self) -> &'static [PropertyDescriptor<T>]
Returns the method properties (from #[php(getter)]/#[php(setter)]).
Lazily initialized on first access from RegisteredClass::method_properties().
Sourcepub fn all_properties(&self) -> impl Iterator<Item = &PropertyDescriptor<T>>
pub fn all_properties(&self) -> impl Iterator<Item = &PropertyDescriptor<T>>
Iterates over all properties (field + method).