Skip to content

Instantly share code, notes, and snippets.

@jw-foss
Created June 15, 2020 03:37
Show Gist options
  • Save jw-foss/ec86f405b4042d4cb8ab8578de3b69fe to your computer and use it in GitHub Desktop.
Save jw-foss/ec86f405b4042d4cb8ab8578de3b69fe to your computer and use it in GitHub Desktop.
Rust way of printing the actual type of a variable
use std::any::type_name;
fn type_of<T>(_: T) -> &'static str {
type_name::<T>()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment