Clone and Derive
We’ve seen the clone()
method for String
s as a way to create a duplicate of an owned String
. In some cases, this can be relevant for dealing with ownership issues. As a reminder, this code fails due to usage of a moved value:
Get hands-on with 1200+ tech skills courses.