Skip to content

Instantly share code, notes, and snippets.

@bvssvni
Last active January 4, 2016 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvssvni/8659736 to your computer and use it in GitHub Desktop.
Save bvssvni/8659736 to your computer and use it in GitHub Desktop.
fn type_name<T>(_: &T) -> &'static str {
unsafe { (*::std::unstable::intrinsics::get_tydesc::<T>()).name }
}
// USAGE
println!("{}", type_name(&x));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment