From 39576bfe434e1b493e128afc45ffd3a0b18c666d Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Tue, 1 Dec 2020 14:44:30 +0100 Subject: [PATCH] Add Archetype TypeInfo::type_name accessor --- crates/bevy_ecs/src/core/archetype.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/bevy_ecs/src/core/archetype.rs b/crates/bevy_ecs/src/core/archetype.rs index 7462f6c909745..f37a671b31317 100644 --- a/crates/bevy_ecs/src/core/archetype.rs +++ b/crates/bevy_ecs/src/core/archetype.rs @@ -484,7 +484,6 @@ pub struct TypeInfo { id: TypeId, layout: Layout, drop: unsafe fn(*mut u8), - #[cfg(debug_assertions)] type_name: &'static str, } @@ -499,7 +498,6 @@ impl TypeInfo { id: TypeId::of::(), layout: Layout::new::(), drop: drop_ptr::, - #[cfg(debug_assertions)] type_name: core::any::type_name::(), } } @@ -519,6 +517,12 @@ impl TypeInfo { pub(crate) unsafe fn drop(&self, data: *mut u8) { (self.drop)(data) } + + #[allow(missing_docs)] + #[inline] + pub fn type_name(&self) -> &'static str { + self.type_name + } } impl PartialOrd for TypeInfo {