[rust-dev] Conflicting implementations of a trait
allen.welkie at gmail.com
Tue Jul 22 09:50:40 PDT 2014
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
Is it possible to simultaneously overload the Complex (*) operator scalars
and complex numbers?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rust-dev