|
|
|
|
|
by fauigerzigerk
739 days ago
|
|
It is operator overloading. Traits are just the mechanism to do operator overloading in Rust. But I think what matters in this particular context is that Rust does not support function overloading and this restriction also applies to functions implementing operators. I think this may be why the parent comment claims that it is not really overloading. The meaning of "overloading" is a bit ambiguous here. So for a concrete type vec3 you cannot define both <vec3> * <double> and <vec3> * <vec3>, which makes type inference a lot easier. It also makes Rust operator overloading less expressive. |
|
https://play.rust-lang.org/?version=stable&mode=debug&editio...