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

[Merged by Bors] - Override size_hint for all Iterators and add ExactSizeIterator where applicable #1734

Closed
wants to merge 5 commits into from

Conversation

MinerSebas
Copy link
Contributor

After #1697 I looked at all other Iterators from Bevy and added overrides for size_hint where it wasn't done.
Also implemented ExactSizeIterator where applicable.

@mockersf
Copy link
Member

mockersf commented Mar 22, 2021

I'm not a fan of implementing size_hint in a way that loops over all the elements. It's supposed to be an optimisation for when you want to have an idea of the length of an iterator without iterating on all its elements...

@MinerSebas
Copy link
Contributor Author

Good Point, I reworked the Implementations in bevy_reflect to not loop, but instead get the length of the underlying vec.

For ShaderDefIterator i couldn't remove the loop, without also removing the ExactSizeIterator.

@alice-i-cecile alice-i-cecile added the C-Code-Quality A section of code that is hard to understand or change label Mar 22, 2021
@cart
Copy link
Member

cart commented Apr 13, 2021

bors r+

bors bot pushed a commit that referenced this pull request Apr 13, 2021
… applicable (#1734)

After #1697 I looked at all other Iterators from Bevy and added overrides for `size_hint` where it wasn't done.
Also implemented `ExactSizeIterator` where applicable.
@bors bors bot changed the title Override size_hint for all Iterators and add ExactSizeIterator where applicable [Merged by Bors] - Override size_hint for all Iterators and add ExactSizeIterator where applicable Apr 13, 2021
@bors bors bot closed this Apr 13, 2021
@MinerSebas MinerSebas deleted the size_hint branch April 15, 2021 12:45
jihiggins pushed a commit to jihiggins/bevy that referenced this pull request Apr 18, 2021
… applicable (bevyengine#1734)

After bevyengine#1697 I looked at all other Iterators from Bevy and added overrides for `size_hint` where it wasn't done.
Also implemented `ExactSizeIterator` where applicable.
ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
… applicable (bevyengine#1734)

After bevyengine#1697 I looked at all other Iterators from Bevy and added overrides for `size_hint` where it wasn't done.
Also implemented `ExactSizeIterator` where applicable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants