1 A binary assignment operator like `+=` or `^=` was applied to a type that
4 Erroneous code example:
7 let mut x = 12f32; // error: binary operation `<<` cannot be applied to
13 To fix this error, please check that this type implements this binary
17 let mut x = 12u32; // the `u32` type does implement the `ShlAssign` trait
22 It is also possible to overload most operators for your own type by
23 implementing the `[OP]Assign` traits from `std::ops`.
25 Another problem you might be facing is this: suppose you've overloaded the `+`
26 operator for some type `Foo` by implementing the `std::ops::Add` trait for
27 `Foo`, but you find that using `+=` does not work, as in this example:
37 fn add(self, rhs: Foo) -> Foo {
43 let mut x: Foo = Foo(5);
44 x += Foo(7); // error, `+= cannot be applied to the type `Foo`
48 This is because `AddAssign` is not automatically implemented, so you need to
49 manually implement it for your type.