Skip to content

Instantly share code, notes, and snippets.

@ozkriff
Created January 22, 2014 05:18
Show Gist options
  • Save ozkriff/8553827 to your computer and use it in GitHub Desktop.
Save ozkriff/8553827 to your computer and use it in GitHub Desktop.
/// usage: let f = 1.0f32; println(type_of(&f));
pub fn type_of<T>(_: &T) -> &'static str {
unsafe {
(*std::unstable::intrinsics::get_tydesc::<T>()).name
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment