Mul operator overloading

fn mul(self,rhs: Person)->Self::Output
         ^^^consuming self, why?

Surely if I want to multiply "a * b" I don't want neither a nor b to be consumed...
Can I have non consuming mul operator?

impl<'a> Mul for &'a Type creates a non-consuming implementation if you need it.

Normally Mul is implemented for Copy types though, so consuming the arguments doesn't actually do anything.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.