For a list of documents, see: Rust Mobile Complex Graphics Rendering Project Development Series summary (table of Contents)

Without this feature, logging is very inconvenient.

RFC: Add “Function Name Macro” was introduced four years ago via function! Provides functionality similar to the __func__ macro definition provided by the C/C++ compiler, currently merged but not yet available.

Equivalent of func or FUNCTION in Rust? Offers a temporary solution:

#! [feature(core_intrinsics)]

macro_rules! function {
    () => {{
        fn f() {}
        fn type_name_of<T>(_: T) -> &'static str {
            extern crate core;
            unsafe { core::intrinsics::type_name::<T>() }
        }
        let name = type_name_of(f);
        &name[6..name.len() - 4]}}}pub fn main() {
    (|| {
        mod module {
            pub trait Trait {
                fn function(&self) {
                    println!("{} (in {} [{}:{}:{}])", function! (),module_path!(), file!(), line!(), column! ()); }}impl Trait for() {} } module::Trait::function(&()); }}) ()Copy the code