1 2 3 4 5 6 7 8 9 10 11
#[macro_export] macro_rules! function { () => {{ fn f() {} fn type_name_of<T>(_: T) -> &'static str { std::any::type_name::<T>() } let name = type_name_of(f); name.strip_suffix("::f").unwrap() }}; }