Skip to main content

Object

Trait Object 

Source
pub trait Object: HasVtable {
    // Provided methods
    fn dtor(&mut self) { ... }
    fn destroy(&mut self) { ... }
    fn create_ui(&self) { ... }
    fn is_enable_instance(&self) -> bool { ... }
    fn create_property(&self, props: *mut c_void) { ... }
    fn get_dti(&self) -> *const c_void { ... }
}
Expand description

Behaviour shared by every MT Framework object, backed by the class’s vtable.

This trait exposes the common virtual functions found at the start of every MtObject vtable. It is implemented for concrete object types via #[derive(Object)]; each method dispatches through the corresponding vtable slot, so calling one runs the game’s own implementation for that object.

Provided Methods§

Source

fn dtor(&mut self)

Runs the destructor on self

Source

fn destroy(&mut self)

Runs the destructor on self and deallocates the object

Source

fn create_ui(&self)

Invokes the object’s UI-creation virtual function (vtable slot 2).

Source

fn is_enable_instance(&self) -> bool

Returns whether the object is currently an enabled instance (vtable slot 3).

Source

fn create_property(&self, props: *mut c_void)

Populates props (an MtPropertyList) with the object’s reflected properties (vtable slot 4).

Prefer the safe MtObject::get_properties wrapper, which builds and returns the list for you.

Source

fn get_dti(&self) -> *const c_void

Returns a raw pointer to the object’s MtDti (vtable slot 5).

Prefer the safe MtObject::dti wrapper, which returns a typed reference.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§