Add Archetype TypeInfo::type_name accessor (#985)
This commit is contained in:
parent
915024bf35
commit
c346d282b6
@ -484,7 +484,6 @@ pub struct TypeInfo {
|
|||||||
id: TypeId,
|
id: TypeId,
|
||||||
layout: Layout,
|
layout: Layout,
|
||||||
drop: unsafe fn(*mut u8),
|
drop: unsafe fn(*mut u8),
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
type_name: &'static str,
|
type_name: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +498,6 @@ impl TypeInfo {
|
|||||||
id: TypeId::of::<T>(),
|
id: TypeId::of::<T>(),
|
||||||
layout: Layout::new::<T>(),
|
layout: Layout::new::<T>(),
|
||||||
drop: drop_ptr::<T>,
|
drop: drop_ptr::<T>,
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
type_name: core::any::type_name::<T>(),
|
type_name: core::any::type_name::<T>(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -519,6 +517,12 @@ impl TypeInfo {
|
|||||||
pub(crate) unsafe fn drop(&self, data: *mut u8) {
|
pub(crate) unsafe fn drop(&self, data: *mut u8) {
|
||||||
(self.drop)(data)
|
(self.drop)(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(missing_docs)]
|
||||||
|
#[inline]
|
||||||
|
pub fn type_name(&self) -> &'static str {
|
||||||
|
self.type_name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialOrd for TypeInfo {
|
impl PartialOrd for TypeInfo {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user