From 5a17fbccf56e395f9eea476442967275cfd544cf Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 5 Jul 2024 08:40:02 +0000 Subject: [PATCH] add type_name debug tool Signed-off-by: Jason Volk --- src/core/debug.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/debug.rs b/src/core/debug.rs index 14d0be87..5e52f399 100644 --- a/src/core/debug.rs +++ b/src/core/debug.rs @@ -80,3 +80,8 @@ pub fn trap() { #[must_use] pub fn panic_str(p: &Box) -> &'static str { p.downcast_ref::<&str>().copied().unwrap_or_default() } + +#[cfg(debug_assertions)] +#[inline(always)] +#[must_use] +pub fn type_name(_: &T) -> &'static str { std::any::type_name::() }