Generics are used to reduce code duplication
It allows to creates functions that can work on multiple datatypes
Generics in Function
PartialOrd is an trait that is implemented by elements that can be compared
Generics in Structs & Enums
Here T and U can be of the same datatype as well
Generics on Methods
The x method will be available for all datatypes but y will only be present on f64 datatype
The generic type mentioned in the implementation block can use a different variable (it will not make any different)
The types of the point that is passed to the method is different from the type of the point on which the method is defined
Performance
Using generics we do not incur any performance penalty as on compile time discrete types of the generics are created as required