Struct red4ext_rs::RttiSystem
source · pub struct RttiSystem(/* private fields */);
Expand description
The RTTI system containing information about all types in the game.
§Example
use red4ext_rs::types::CName;
use red4ext_rs::RttiSystem;
fn rtti_example() {
let rtti = RttiSystem::get();
let class = rtti.get_class(CName::new("IScriptable")).unwrap();
for method in class.methods() {
// do something with the method
}
}
Implementations§
source§impl RttiSystem
impl RttiSystem
sourcepub fn get<'a>() -> RwSpinLockReadGuard<'a, Self>
pub fn get<'a>() -> RwSpinLockReadGuard<'a, Self>
Acquire a read lock on the RTTI system.
sourcepub fn get_bitfield(&self, name: CName) -> Option<&Bitfield>
pub fn get_bitfield(&self, name: CName) -> Option<&Bitfield>
Retrieve a bitfield by its name.
sourcepub fn get_function(&self, name: CName) -> Option<&Function>
pub fn get_function(&self, name: CName) -> Option<&Function>
Retrieve a function by its name.
sourcepub fn get_native_types(&self) -> RedArray<&Type>
pub fn get_native_types(&self) -> RedArray<&Type>
Retrieve all native types and collect them into a RedArray
`.
sourcepub fn get_enums(&self) -> RedArray<&Enum>
pub fn get_enums(&self) -> RedArray<&Enum>
Retrieve all enums and collect them into a RedArray
`.
sourcepub fn get_bitfields(&self, scripted_only: bool) -> RedArray<&Bitfield>
pub fn get_bitfields(&self, scripted_only: bool) -> RedArray<&Bitfield>
Retrieve all bitfields and collect them into a RedArray
`.
sourcepub fn get_global_functions(&self) -> RedArray<&Function>
pub fn get_global_functions(&self) -> RedArray<&Function>
Retrieve all global functions and collect them into a RedArray
`.
sourcepub fn get_class_functions(&self) -> RedArray<&Function>
pub fn get_class_functions(&self) -> RedArray<&Function>
Retrieve all instance methods and collect them into a RedArray
`.
sourcepub fn get_classes(
&self,
base: &Class,
include_abstract: bool,
) -> RedArray<&Class>
pub fn get_classes( &self, base: &Class, include_abstract: bool, ) -> RedArray<&Class>
Retrieve base class and its inheritors, optionally including abstract classes.
sourcepub fn get_derived_classes(&self, base: &Class) -> RedArray<&Class>
pub fn get_derived_classes(&self, base: &Class) -> RedArray<&Class>
Retrieve derived classes, omitting base in the output.
sourcepub fn get_class_by_script_name(&self, name: CName) -> Option<&Class>
pub fn get_class_by_script_name(&self, name: CName) -> Option<&Class>
Retrieve a class by its script name.
sourcepub fn get_enum_by_script_name(&self, name: CName) -> Option<&Enum>
pub fn get_enum_by_script_name(&self, name: CName) -> Option<&Enum>
Retrieve an enum by its script name.
sourcepub fn type_map(&self) -> &RedHashMap<CName, &Type>
pub fn type_map(&self) -> &RedHashMap<CName, &Type>
Retrieve a reference to a map of all types by name.
sourcepub fn script_to_native_map(&self) -> &RedHashMap<CName, CName>
pub fn script_to_native_map(&self) -> &RedHashMap<CName, CName>
Retrieve a reference to a map of all script to native name aliases.
sourcepub fn native_to_script_map(&self) -> &RedHashMap<CName, CName>
pub fn native_to_script_map(&self) -> &RedHashMap<CName, CName>
Retrieve a reference to a map of all native to script name aliases.
sourcepub fn resolve_static_method_by_full_name(
&self,
full_name: &str,
) -> Option<&Function>
pub fn resolve_static_method_by_full_name( &self, full_name: &str, ) -> Option<&Function>
Resolves a static method by its full name, which should be in the format Class::Method
.
sourcepub fn resolve_static_context(
&self,
class: CName,
) -> Option<Ref<ScriptableSystem>>
pub fn resolve_static_context( &self, class: CName, ) -> Option<Ref<ScriptableSystem>>
Resolve the context required for a call to a static scripted method on specified class.
Returns None
if the class was not found in the RTTI system.