From b4d52821234bb8575523032624492985a09d2863 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 4 Aug 2024 06:03:58 +0000 Subject: [PATCH] add nullary type_name debug util Signed-off-by: Jason Volk --- src/core/debug.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/debug.rs b/src/core/debug.rs index 3ab9ed0d..f6c992b9 100644 --- a/src/core/debug.rs +++ b/src/core/debug.rs @@ -84,10 +84,13 @@ 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::() } +pub fn rttype_name(_: &T) -> &'static str { type_name::() } + +#[inline(always)] +#[must_use] +pub fn type_name() -> &'static str { std::any::type_name::() } #[must_use] #[inline]