#[derive(Default, Clone)] pub struct TypeMetadata { pub objects: HashMap<&'static str, &'static VTable>, pub operations: HashMap, &'static VTable>, pub settings: HashMap, &'static VTable>, pub values: HashMap, &'static VTable>, } impl TypeMetadata { pub unsafe fn from_static() -> &'static Self { giterated_static_runtime::get_type_metadata_reference() .cast::() .as_ref() } pub fn register_object(&mut self, object_kind: &'static str, vtable: &'static VTable) { trace!("Registering type metadata for {}", object_kind); self.objects.insert(object_kind, vtable); } pub fn register_operation( &mut self, object_kind: &'static str, operation_name: &'static str, vtable: &'static VTable, ) { trace!( "Registering operation metadata for {}::{}", object_kind, operation_name ); self.operations.insert( ObjectOperationPair { object_kind, operation_name, }, vtable, ); } pub fn register_setting( &mut self, object_kind: &'static str, setting_name: &'static str, vtable: &'static VTable, ) { trace!("Registering setting {}::{}", object_kind, setting_name); self.settings.insert( ObjectSettingPair { object_kind, setting_name, }, vtable, ); } pub fn register_value( &mut self, object_kind: &'static str, value_name: &'static str, vtable: &'static VTable, ) { trace!("Registering value {}::{}", object_kind, value_name); self.values.insert( ObjectValuePair { object_kind, value_name, }, vtable, ); } }