0

I came up to a syntax such as

std::mem::size_of::<usize>()

digged a bit more and found it can be implemented via type_name

use std::any::type_name;
//example usage
type_name::<T>() 

Trying to figure out if it is possible to write custom functions such as above. I am not sure what is my question here but i am confused about the syntax here. any help or direction is appreciated. thanks!

serkan
  • 6,885
  • 4
  • 41
  • 49
  • It is the syntax to specify generic parameters explicitly, which is not required in many circumstances, but is required in these examples since the type cannot be inferred from the arguments or return type. – kmdreko Mar 09 '23 at 19:14

0 Answers0