macro_rules! name_of_type {
($t: ty) => { ... };
}Expand description
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));