Contracts of the Clone trait?

I would say that the convention is for Clone to be as shallow as possible.

Thanks to the borrow checker, you can't generally tell the difference between shallow and deep copies in rust unless the type happens to have interior mutability. This makes shallow copies the clear winner for the majority of use cases in rust, and so it's simply not something the average rust author thinks about every day.

6 Likes