glib

Macro function_name

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

bar::sample_function();