of

Macro of 

Source
macro_rules! of {
    ($ident:ident $(::<$($arg:ty),*>)?) => { ... };
}
Expand description

Get the name of the given identifier.

This macro can be used to get the name of local variables, contants and functions.

This macro checks that the identifier is valid in the current scope. If the identifier is renamed via refactoring tools, the macro call will be updated accordingly.

ยงExamples

fn my_function() {}
let my_variable = 42;
assert_eq!(pretty_name::of!(my_function), "my_function");
assert_eq!(pretty_name::of!(my_variable), "my_variable");