macro_rules! function_name {
() => { ... };
}Expand description
This macro returns the name of the enclosing function.
As the internal implementation is based on the std::any::type_name, this macro derives
all the limitations of this function.
§Examples
mod bar {
pub fn sample_function() {
use mecomp_core::function_name;
assert!(function_name!().ends_with("bar::sample_function"));
}
}
bar::sample_function();§Note
This macro is copied from the stdext crate. https://github.com/popzxc/stdext-rs