#[function_name]

Function attribute that generates a function_name! macro in the scope of the function's body.

The generated function_name!() is a macro that expands to the name of the annotated function, as a string literal.

Examples

```rust use ::functionname::functionname;

[function_name]

fn mysuperduperfunction () { asserteq!( functionname!(), "mysuperduperfunction", ); } ```

Since the generated function_name! expands to a string literal, it can be used with other macros such as concat!:

```rust

[macrouse] extern crate functionname;

macrorules! functionpath {() => (concat!( modulepath!(), "::", functionname!() ))}

pub mod foo { pub mod bar { #[functionname] pub fn baz () { asserteq!( functionpath!(), [ env!("CARGOPKG_NAME"), "foo", "bar", "baz", ].join("::"), ); } } } ```