fn_name

Macros that produce the name of the function they're invoked within.

Uninstantiated Names

The uninstantiated! macro produces the name of the surrounding function or method, without generics instantiated; e.g.: ```rust struct GenericType(A);

impl GenericType { fn genericmethod(self, _: B) -> &'static str { fnname::uninstantiated!() } }

fn main() { asserteq!( GenericType(42u8).genericmethod(false), "GenericType<_>::generic_method" ); } ```

Instantiated Names

The instantiated! macro produces the name of the surrounding function or method, including instantiated generics (if any); e.g.: ```rust struct GenericType(A);

impl GenericType { fn genericmethod(self, _: B) -> &'static str { fnname::instantiated!() } }

fn main() { asserteq!( GenericType(42u8).genericmethod(false), "GenericType::generic_method" ); } ```

Limitations

The expansion of these macros is not (yet) const evaluable; their implementations rely on core::any::type_name, which is not a const fn.