I was implementing a Bitset structure and implementing
IndexMut for it. When I came about writing the body for
IndexMut I realised that I must return a
&mut to, in this case, a single bit. Because that is not possible, as far as I can tell, I thought that I could maybe return some type of proxy object that, when assigned to, would write to the corresponding bit.
Irrespective of that design, I found out that there are traits for
MulAssign, etc., but no
Assign to overload the assignment
Being this perfectly common in C++, I wonder why Rust forbids overloading this particular operator. I found this discussion, but can’t find an explanation of the rationale behind this decission.
Any light on the issue?