I have two structs say struct A and struct B. I have the Add implemented for A and B.
impl Add<&B> for A{
type Output = A;
fn add(self, rhs: &B) -> A{
--snip--
}
Now, I want to implement the AddAssign, but I think there should be an idiomatic way to use Add. Something like:
impl AddAssign<&B> for A {
fn add_assign(&mut self, rhs: &B) {
*self = *self + rhs;
}
}
Is there a way to do it?