mirror of
https://github.com/guilhermewerner/reflection
synced 2025-06-16 13:34:19 +00:00
Create initial reflection system
This commit is contained in:
23
Source/Class.rs
Normal file
23
Source/Class.rs
Normal 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user