Trait ext_php_rs::class::RegisteredClass [−][src]
pub trait RegisteredClass: Sized + 'static {
const CLASS_NAME: &'static str;
const CONSTRUCTOR: Option<ConstructorMeta<Self>>;
fn get_metadata() -> &'static ClassMetadata<Self>;
fn get_properties<'a>() -> HashMap<&'static str, Property<'a, Self>>;
}
Expand description
Implemented on Rust types which are exported to PHP. Allows users to get and set PHP properties on the object.
Associated Constants
const CLASS_NAME: &'static str
const CLASS_NAME: &'static str
PHP class name of the registered class.
const CONSTRUCTOR: Option<ConstructorMeta<Self>>
const CONSTRUCTOR: Option<ConstructorMeta<Self>>
Optional class constructor.
Required methods
fn get_metadata() -> &'static ClassMetadata<Self>
fn get_metadata() -> &'static ClassMetadata<Self>
Returns a reference to the class metadata, which stores the class entry and handlers.
This must be statically allocated, and is usually done through the
macro@php_class
macro.
fn get_properties<'a>() -> HashMap<&'static str, Property<'a, Self>>
fn get_properties<'a>() -> HashMap<&'static str, Property<'a, Self>>
Returns a hash table containing the properties of the class.
The key should be the name of the property and the value should be a
reference to the property with reference to self
. The value is a
Property
.
Instead of using this method directly, you should access the properties
through the ClassMetadata::get_properties
function, which builds the
hashmap one and stores it in memory.