pub trait RegisteredClass: Sized + 'static {
    const CLASS_NAME: &'static str;
    const CONSTRUCTOR: Option<ConstructorMeta<Self>> = None;

    // Required methods
    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.

Required Associated Constants§

source

const CLASS_NAME: &'static str

PHP class name of the registered class.

Provided Associated Constants§

source

const CONSTRUCTOR: Option<ConstructorMeta<Self>> = None

Optional class constructor.

Required Methods§

source

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.

source

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.

Implementors§

source§

impl RegisteredClass for Closure

Available on crate feature closure only.
source§

const CLASS_NAME: &'static str = "RustClosure"