Can there be two simultaneous implementations of a generic trait? I ask
because I want to extend the Complex class to allow for multiplication by
scalars, so that you can use "a * b" where "a" and "b" can be either
scalars or Complex.

The Complex struct already has an implementation of the Mul trait. I wanted
to add another, so I added the implementation of Mul<T, Complex<T>> for
Complex<T>, and used the scale() function. But I get a compiler error
saying that there are conflicting implementations for trait
'core::ops::Mul'.

Is it possible to simultaneously overload the Complex (*) operator scalars
and complex numbers?
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to