Hi,
I read that rust does not handle function overloading. So I seek your
advise to how I should be handling the following case.
I have a struct vec2d, which is a 2d vector. vec2d{x:float, y:float}
I would like to implement the trait Mul such that I can multiply a vector
by another vector, component by component
let v1: Vec2d = ...;
let v2: Vec2d = ...;
v1*v2;
but I also would like to be able to multiply a vec2d with a scalar.
let v3 = v1*-1f;
I tried implementing the trait Mul twice but the compiler complains. How
would you do it?
cheers,
Rémi
--
Rémi Fontan : [email protected]
mobile: +64 21 855 351
93 Otaki Street, Miramar 6022
Wellington, New Zealand
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev