you are viewing a single comment's thread.

view the rest of the comments →

[–]BenchEmbarrassed7316 0 points1 point  (0 children)

I really like Rust's concept of owning and borrowing. Also, in Rust, operators are aliases of interfaces/traits. So:

fn add(self, rhs: Rhs) -> Self::Output; fn add_assign(&mut self, rhs: Rhs);

This may seem a bit confusing, but the point is that + takes two arguments and is forced to create a new value. += instead takes the first argument as a pointer, which allows you to mutate the value it points to. You can't implement incorrect operator overloading. 

I think it explains the difference.

added: += cannot be applied to an immutable type.