[rust-dev] Fwd: &self/&mut self in traits considered harmful(?)

Patrick Walton pcwalton at mozilla.com
Mon Jun 16 10:36:22 PDT 2014


On 6/16/14 7:32 AM, Sebastian Gesemann wrote:
> Assuming this RFC is accepted: How would I have to implement Add for a
> custom type T where moving doesn't make much sense and I'd rather use
> immutable references to bind the operands?

You don't implement Add for those types.

The purpose of strongly-typed (as opposed to ad-hoc, like C++) traits is 
that you can actually tell what the type signature is.

Patrick



More information about the Rust-dev mailing list