/// Gets the name of the function that this macro is called from.
#[macro_export]
macro_rules! current_function {
() => {{
fn f() {}
fn type_name_of<T>(_: T) -> &'static str {
std::any::type_name::<T>()
}
type_name_of(f)
.rsplit("::")
.find(|&part| part != "f" && part != "{{closure}}")
.expect("Failed to find function name")
}};
}