Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More iteration trait wisdom #68

Open
HadrienG2 opened this issue Sep 7, 2023 · 0 comments
Open

More iteration trait wisdom #68

HadrienG2 opened this issue Sep 7, 2023 · 0 comments

Comments

@HadrienG2
Copy link

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:

  • Iterator is 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.
  • Extend is a thing and FromIterator should almost always be implemented in terms of it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant