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

source

pub fn get<'a>() -> RwSpinLockReadGuard<'a, Self>

Acquire a read lock on the RTTI system.

source

pub fn get_class(&self, name: CName) -> Option<&Class>

Retrieve a class by its name.

source

pub fn get_type(&self, name: CName) -> Option<&Type>

Retrieve a type by its name.

source

pub fn get_enum(&self, name: CName) -> Option<&Enum>

Retrieve an enum by its name.

source

pub fn get_bitfield(&self, name: CName) -> Option<&Bitfield>

Retrieve a bitfield by its name.

source

pub fn get_function(&self, name: CName) -> Option<&Function>

Retrieve a function by its name.

source

pub fn get_native_types(&self) -> RedArray<&Type>

Retrieve all native types and collect them into a RedArray`.

source

pub fn get_enums(&self) -> RedArray<&Enum>

Retrieve all enums and collect them into a RedArray`.

source

pub fn get_bitfields(&self, scripted_only: bool) -> RedArray<&Bitfield>

Retrieve all bitfields and collect them into a RedArray`.

source

pub fn get_global_functions(&self) -> RedArray<&Function>

Retrieve all global functions and collect them into a RedArray`.

source

pub fn get_class_functions(&self) -> RedArray<&Function>

Retrieve all instance methods and collect them into a RedArray`.

source

pub fn get_classes( &self, base: &Class, include_abstract: bool, ) -> RedArray<&Class>

Retrieve base class and its inheritors, optionally including abstract classes.

source

pub fn get_derived_classes(&self, base: &Class) -> RedArray<&Class>

Retrieve derived classes, omitting base in the output.

source

pub fn get_class_by_script_name(&self, name: CName) -> Option<&Class>

Retrieve a class by its script name.

source

pub fn get_enum_by_script_name(&self, name: CName) -> Option<&Enum>

Retrieve an enum by its script name.

source

pub fn type_map(&self) -> &RedHashMap<CName, &Type>

Retrieve a reference to a map of all types by name.

source

pub fn script_to_native_map(&self) -> &RedHashMap<CName, CName>

Retrieve a reference to a map of all script to native name aliases.

source

pub fn native_to_script_map(&self) -> &RedHashMap<CName, CName>

Retrieve a reference to a map of all native to script name aliases.

source

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.

source

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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.