pub fn type_namem_opts<T>(
m: usize,
type_params_fmt_opts: TypeParamsFmtOpts,
) -> Stringwhere
T: ?Sized,
Expand description
Returns the type name with at most m
most significant module path segments.
§Parameters
m
: Number of most significant module path segments to include.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
pub mod a {
pub mod b {
pub mod c {
pub struct MyStruct<T>(T);
}
}
}
assert_eq!(
tynm::type_namem_opts::<MyStruct<String>>(1, TypeParamsFmtOpts::All),
"rust_out::..::MyStruct<alloc::..::String>",
);
assert_eq!(
tynm::type_namem_opts::<MyStruct<String>>(1, TypeParamsFmtOpts::Std),
"rust_out::..::MyStruct",
);