Skip to content

Commit c346d28

Browse files
author
Tomasz Sterna
authored
Add Archetype TypeInfo::type_name accessor (#985)
1 parent 915024b commit c346d28

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/bevy_ecs/src/core/archetype.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ pub struct TypeInfo {
484484
id: TypeId,
485485
layout: Layout,
486486
drop: unsafe fn(*mut u8),
487-
#[cfg(debug_assertions)]
488487
type_name: &'static str,
489488
}
490489

@@ -499,7 +498,6 @@ impl TypeInfo {
499498
id: TypeId::of::<T>(),
500499
layout: Layout::new::<T>(),
501500
drop: drop_ptr::<T>,
502-
#[cfg(debug_assertions)]
503501
type_name: core::any::type_name::<T>(),
504502
}
505503
}
@@ -519,6 +517,12 @@ impl TypeInfo {
519517
pub(crate) unsafe fn drop(&self, data: *mut u8) {
520518
(self.drop)(data)
521519
}
520+
521+
#[allow(missing_docs)]
522+
#[inline]
523+
pub fn type_name(&self) -> &'static str {
524+
self.type_name
525+
}
522526
}
523527

524528
impl PartialOrd for TypeInfo {

0 commit comments

Comments
 (0)