Remove Engine::custom_types.

This commit is contained in:
Stephen Chung
2022-03-29 08:18:20 +08:00
parent 2b9b84a764
commit 1b6de25007
6 changed files with 35 additions and 15 deletions

View File

@@ -27,13 +27,18 @@ impl CustomTypesCollection {
}
/// Register a custom type.
#[inline(always)]
pub fn add(&mut self, key: impl Into<Identifier>, name: impl Into<Identifier>) {
self.0.insert(key.into(), name.into());
pub fn add(&mut self, type_name: impl Into<Identifier>, name: impl Into<Identifier>) {
self.add_raw(type_name, name.into());
}
/// Register a custom type.
#[inline(always)]
pub fn add_type<T>(&mut self, name: &str) {
self.0.insert(type_name::<T>().into(), name.into());
self.add_raw(type_name::<T>(), name.into());
}
/// Register a custom type.
#[inline(always)]
pub fn add_raw(&mut self, type_name: impl Into<Identifier>, custom_type: CustomType) {
self.0.insert(type_name.into(), custom_type);
}
/// Find a custom type.
#[inline(always)]