[][src]Macro stdext::function_name

macro_rules! function_name {
    () => { ... };
}

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 stdext::function_name;
        assert!(function_name!().ends_with("bar::sample_function"));
    }
}

bar::sample_function();