3 ms·
> The junior solution is .clone() I really hope it’s an Rc/Arc that you’re cloning. Just deep cloning the value to get ownership is dangerous when you’re doing
by vlovich123 1y ago
> The junior solution is .clone()
I really hope it’s an Rc/Arc that you’re cloning. Just deep cloning the value to get ownership is dangerous when you’re doing it blindly.
- dev_l1x_be 1y agoSure thing, this is why you need to learn what happens with copy and clone. Interestingly smaller problems are going to be ok even with clone(). The real value is to be able to spot potential performance optimizations by grep '(copy|clone)'.
- vlovich123 1y agoHow are you going to grep for copies? You know there’s no .copy method right?