type_name

Function type_name 

Source
pub fn type_name<T: ?Sized>() -> &'static str
Expand description

Get the human-friendly type name of given type T.

Note that you can also use the pretty_name::of_type!(T) macro, which expands to a string literal at compile time if T is a simple type identifier, and expands to a call to this function otherwise.

ยงExamples

use pretty_name::type_name;
assert_eq!(type_name::<Option<i32>>(), "Option<i32>");
assert_eq!(type_name::<&str>(), "&str");
assert_eq!(type_name::<Vec<Box<dyn std::fmt::Debug>>>(), "Vec<Box<dyn Debug>>");