[][src]Macro nameof::name_of_type

macro_rules! name_of_type {
    ($t: ty) => { ... };
}

Takes the name of a type as its sole parameter, e.g. name_of_type!(SomeStruct) or name_of_type!(f64).

It is an alternative to the name_of!(type T) macro, specifically for types.

Examples

struct TestStruct {
    test_field: i32
}

println!("Struct is called `{}`.", name_of_type!(TestStruct));
println!("Type is called `{}`.", name_of_type!(i32));