Not right now. Extending the language to allow this is the subject of RFC 24: https://github.com/rust-lang/rfcs/blob/master/active/0024-traits.md
On Tue, Jul 22, 2014 at 9:50 AM, Allen Welkie <[email protected]> wrote: > 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 > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > -- http://octayn.net/ _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
