Expand description
Proc macro to insert function name within body of function
Usage
use func_::_func_;
#[_func_]
fn my_func() {
assert_eq!(__func__, "my_func");
println!("{__func__}: log with function name");
}
#[_func_]
fn my_generic_func<T>() {
assert_eq!(__func__, "my_generic_func");
println!("{__func__}: log with generic function name but without generics bullshit cuz why the would I want generics in my generic name?");
}
#[_func_]
const fn const_func() {
assert!(__func__.len() == "const_func".len());
}
#[_func_]
async fn async_func() {
assert_eq!(__func__, "async_func");
}
my_func();
my_generic_func::<u16>();
const_func();
Attribute Macros
- Adds constant
__func__
with name of function to the function’s body.