diff options
author | HampusM <hampus@hampusmat.com> | 2024-08-14 20:05:30 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-08-14 20:05:30 +0200 |
commit | 07aa59a122cc5e14d2fb2e2c6e3d8f82e4397bde (patch) | |
tree | 0ac63f5262d97d3d7f50ab1c72d1ace61935608c /ecs/src/type_name.rs | |
parent | e9074af15cae7b3c354e524e9fa78cbddb20ff84 (diff) |
feat(ecs): add component added event
Diffstat (limited to 'ecs/src/type_name.rs')
-rw-r--r-- | ecs/src/type_name.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ecs/src/type_name.rs b/ecs/src/type_name.rs index 5892c6f..54179be 100644 --- a/ecs/src/type_name.rs +++ b/ecs/src/type_name.rs @@ -1,5 +1,15 @@ +use std::any::type_name; + pub trait TypeName { /// Returns the name of this type. fn type_name(&self) -> &'static str; } + +impl<Item> TypeName for Vec<Item> +{ + fn type_name(&self) -> &'static str + { + type_name::<Self>() + } +} |