Skip to content

Instantly share code, notes, and snippets.

@Squab
Created March 29, 2015 02:49
Show Gist options
  • Save Squab/19277f56a508b15bd010 to your computer and use it in GitHub Desktop.
Save Squab/19277f56a508b15bd010 to your computer and use it in GitHub Desktop.
Find type of something in Rust
#![feature(core)]
fn print_type_of<T>(_: &T) -> () {
let type_name =
unsafe {
std::intrinsics::type_name::<T>()
};
println!("{}", type_name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment