implement iterators that yield UniqueEntitySlice#17796
Merged
alice-i-cecile merged 3 commits intobevyengine:mainfrom Feb 12, 2025
Merged
implement iterators that yield UniqueEntitySlice#17796alice-i-cecile merged 3 commits intobevyengine:mainfrom
alice-i-cecile merged 3 commits intobevyengine:mainfrom
Conversation
alice-i-cecile
approved these changes
Feb 11, 2025
Member
|
As always, clean work. Thanks! |
chescock
approved these changes
Feb 12, 2025
| } | ||
| } | ||
|
|
||
| /// An iterator that yields unique entity/entity borrow slices. |
Contributor
There was a problem hiding this comment.
This comment was a little unclear to me at first. I wasn't sure whether this meant the slices were unique, or the contents of each slice were unique, or the contents of all slices together were unique. Since you have fn windows(), it must be the middle one.
Maybe it would help to use the UniqueEntitySlice type name? That would make the meaning of Unique unambiguous. Maybe something like "An iterator that yields &UniqueEntitySlices. Note that an entity may appear in more than one UniqueEntitySlice, but no more than once within each UniqueEntitySlice."
(And similarly for UniqueEntitySliceIterMut.)
Contributor
Author
There was a problem hiding this comment.
I've clarified a bit!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Continuation of #17589 and #16547.
Slices have several methods that return iterators which themselves yield slices, which we have not yet implemented.
An example use is
par_iter_manystyle logic.Solution
Their implementation is rather straightforward, we simply delegate all impls to
[T].The resulting iterator types need their own wrappers in the form of
UniqueEntitySliceIterandUniqueEntitySliceIterMut.We also add three free functions that cast slices of entity slices to slices of
UniqueEntitySlice.These three should be sufficient, though infinite nesting is achievable with a trait (like
TrustedEntityBorrowworks over infinite reference nesting), should the need ever arise.