You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ret first.num.cmp(second.num) // assuming type i32 has an implementation for PartialOrd[i32]]
}
// implementing a trait on a struct allows a value of that struct type to be used as generic function arguments that ask for a generic type implementing PartialOrd
// To make the * operator work, Vector2 needs to implement a multiplication trait.
// If traits weren't generic, Vector2 could only multiply with another Vector2. But because the trait is generic, you can explicitly tell the compiler how to multiply a Vector2 with a float: