diff options
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>() + } +} |