1 2 3 4 5 6 7 8 9 10 11 12 13
/// equivalent of __func__ for stacktrace/debugging /// see https://stackoverflow.com/questions/38088067/equivalent-of-func-or-function-in-rust #[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[..name.len() - 3] }}; }