pub struct MtObject;Expand description
The root class of MT Framework’s object system (MtObject).
Nearly every game class derives from MtObject; it provides the reflection
machinery shared by all of them - a link to the class’s MtDti and the
ability to enumerate its reflected properties as an MtPropertyList. The
shared virtual-function behaviour (destructors, construction, property
creation, DTI access) lives in the Object trait, which this type
implements via #[derive(Object)].
Instances are owned by the game; you work with them through references,
usually after obtaining one from the game or constructing a concrete
subclass through its MtDti.
Implementations§
Source§impl MtObject
impl MtObject
Sourcepub fn get_properties(&self) -> MtPropertyList
pub fn get_properties(&self) -> MtPropertyList
Collects this object’s reflected properties into an MtPropertyList.
Invokes the object’s property-creation virtual function to populate a fresh list, which can then be iterated to inspect each property.
Sourcepub fn to<T: Object>(&self) -> &T
pub fn to<T: Object>(&self) -> &T
Reinterprets this object as a shared reference to the subclass T.
This is an unchecked downcast; the caller must ensure the object is
actually a T (e.g. via MtDti::is_a).
Sourcepub fn to_mut<T: Object>(&mut self) -> &mut T
pub fn to_mut<T: Object>(&mut self) -> &mut T
Reinterprets this object as a mutable reference to the subclass T.
This is an unchecked downcast; the caller must ensure the object is
actually a T (e.g. via MtDti::is_a).
Trait Implementations§
Source§impl Object for MtObject
impl Object for MtObject
Source§fn is_enable_instance(&self) -> bool
fn is_enable_instance(&self) -> bool
Source§fn create_property(&self, props: &mut MtPropertyList)
fn create_property(&self, props: &mut MtPropertyList)
props with the object’s reflected properties. Read moreSource§fn to_mt_object(&self) -> &MtObject
fn to_mt_object(&self) -> &MtObject
MtObject.Source§fn to_mut_mt_object(&mut self) -> &mut MtObject
fn to_mut_mt_object(&mut self) -> &mut MtObject
MtObject.