add type_name debug tool

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-05 08:40:02 +00:00
parent 5ed95ea357
commit 5a17fbccf5
1 changed files with 5 additions and 0 deletions

View File

@ -80,3 +80,8 @@ pub fn trap() {
#[must_use]
pub fn panic_str(p: &Box<dyn Any + Send>) -> &'static str { p.downcast_ref::<&str>().copied().unwrap_or_default() }
#[cfg(debug_assertions)]
#[inline(always)]
#[must_use]
pub fn type_name<T>(_: &T) -> &'static str { std::any::type_name::<T>() }