rust-blog
rust-blog copied to clipboard
More iteration trait wisdom
Here are a few extra things I wish I knew when I started messing with Rust's iteration traits, in addition to what your tour of Rust traits already contains:
Iteratoris one of those few traits where you should really consider overloading the default implementation of some methods (size_hint, nth...), as it is suboptimal in many cases.Extendis a thing andFromIteratorshould almost always be implemented in terms of it.