Function type_namemn_opts

Source
pub fn type_namemn_opts<T>(
    m: usize,
    n: usize,
    type_params_fmt_opts: TypeParamsFmtOpts,
) -> String
where T: ?Sized,
Expand description

Returns the type name with m most significant, and n least significant module path segments.

§Parameters

  • m: Number of most significant module path segments to include.
  • n: Number of least 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_namemn_opts::<MyStruct<String>>(1, 1, TypeParamsFmtOpts::Std),
    "rust_out::..::c::MyStruct",
);