The Clone trait has a sadly-neglected clone_from method that clones a value into an existing one. There is a default implementation, but it's fairly naive and therefore not optimal for all cases, notably collections.
It would be good if the major collections had better implementations for clone_from where it can be implemented more efficiently.
/cc @rust-lang/libs
The
Clonetrait has a sadly-neglectedclone_frommethod that clones a value into an existing one. There is a default implementation, but it's fairly naive and therefore not optimal for all cases, notably collections.It would be good if the major collections had better implementations for
clone_fromwhere it can be implemented more efficiently./cc @rust-lang/libs