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 set_arg_info(&self, arg_info: OwnedArgInfo)
pub fn set_arg_info(&self, arg_info: OwnedArgInfo)
Takes ownership of the argument info tables of this class’s methods.
zend_register_functions keeps zend_internal_function.arg_info
pointing into these for the life of the process, so they must outlive
registration. Called once, from ClassBuilder::register.
§Panics
If the argument info has already been set.
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).
Sourcepub fn mangled_names(&self) -> &[Box<str>]
pub fn mangled_names(&self) -> &[Box<str>]
Returns the PHP-convention mangled names of every property, in
all_properties order.
Private properties mangle to "\0Class\0name", protected ones to
"\0*\0name", public ones keep their name. Computed once per class on
first access, one allocation for the process lifetime.