Many iterators implement the Clone trait, but none of them implement the Copy trait. At least for simple iterators like std:slice::Iter, the Clone implementation looks like a memcpy anyway, so why isn't Copy also implemented?
From PR #20790:
This PR also makes iterator non-implicitly copyable, as this was source of subtle bugs in the libraries. You can still use
clone()to explictly copy the iterator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With