Files
reflection/Source/Class.rs
2022-05-22 13:41:48 -03:00

29 lines
555 B
Rust

use crate::Property;
use std::any::{type_name, TypeId};
use std::borrow::Cow;
use std::collections::HashMap;
pub struct Class {
id: TypeId,
name: Cow<'static, str>,
properties: HashMap<Cow<'static, str>, Property>,
}
impl Class {
pub fn New<T: 'static>() -> Self {
Self {
id: TypeId::of::<T>(),
name: type_name::<T>().into(),
properties: HashMap::new(),
}
}
pub fn GetId(&self) -> TypeId {
self.id
}
pub fn GetName(&self) -> &str {
&self.name
}
}