1

Why can't I just use &self in the Add trait:

pub trait Add<RHS = Self> {
    type Output;
    fn add(self, rhs: RHS) -> Self::Output;
}

That way I don't have to worry about my struct moving after I use the + operator. It's generally not a problem for me cause I use #[derive(Debug, Copy, Clone)] but still I wonder why.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
youngwerth
  • 602
  • 5
  • 11

0 Answers0