|
|
|
|
|
by BlackFly
1311 days ago
|
|
Except a lot of structs also derive and prefer `Copy` and a lot of rust code also avoids heap allocation which requires `Clone`. The `Copy` trait can be used implicitly like in the example here. On the other hand, due to the lack of garbage collector, you wouldn't be able to return the reference to the copy which might lead you to find your accidental copy. |
|
I agree with you for the garbage collector. By design, a GC allows you to willy-nilly copy without thinking about the consequences.