Print Type in Rust

If you want to print the type in Rust (similar to %T in Go ), here’s a snippet:

fn type_of<T>(_: &T) -> String {
    format!("{}", std::any::type_name::<T>())
}
Edit this page on GitHub