From c346d282b68ce9f2e6e707b8d8ba53cfac569d8d Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Wed, 2 Dec 2020 23:33:17 +0100 Subject: [PATCH] Add Archetype TypeInfo::type_name accessor (#985) --- 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 6034d30fee..bd3763ad6e 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 {