Function tynm::type_name_opts
source · pub fn type_name_opts<T>(type_params_fmt_opts: TypeParamsFmtOpts) -> Stringwhere
T: ?Sized,
Expand description
Returns the simple type name.
§Parameters
type_params_fmt_opts
: How to format type parameters, see the type documentation for details.
§Type Parameters
T
: Type whose simple type name should be returned.
§Examples
struct MyStruct<T>(T);
assert_eq!(
tynm::type_name_opts::<MyStruct<String>>(TypeParamsFmtOpts::All),
"MyStruct<String>",
);
assert_eq!(
tynm::type_name_opts::<MyStruct<String>>(TypeParamsFmtOpts::Std),
"MyStruct",
);
assert_eq!(
tynm::type_name_opts::<Vec<MyStruct<String>>>(TypeParamsFmtOpts::Std),
"Vec<MyStruct>",
);