Create initial reflection system

This commit is contained in:
Werner
2021-12-23 08:46:30 -03:00
parent aa549e37ef
commit 19eebb4085
10 changed files with 174 additions and 0 deletions

23
Source/Class.rs Normal file
View File

@ -0,0 +1,23 @@
use std::any::{type_name, TypeId};
pub struct Class {
id: TypeId,
name: &'static str,
}
impl Class {
pub fn New<T: 'static>() -> Self {
Self {
id: TypeId::of::<T>(),
name: type_name::<T>().into(),
}
}
pub fn GetId(&self) -> TypeId {
self.id
}
pub fn GetName(&self) -> &'static str {
self.name
}
}