forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove broken
DoubleEndedIterator
impls on event iterators (bevyeng…
…ine#7469) The `DoubleEndedIterator` impls produce incorrect results on subsequent calls to `iter()` if the iterator is only partially consumed. The following code shows what happens ```rust fn next_back_is_bad() { let mut events = Events::<TestEvent>::default(); events.send(TestEvent { i: 0 }); events.send(TestEvent { i: 1 }); events.send(TestEvent { i: 2 }); let mut reader = events.get_reader(); let mut iter = reader.iter(&events); assert_eq!(iter.next_back(), Some(&TestEvent { i: 2 })); assert_eq!(iter.next(), Some(&TestEvent { i: 0 })); let mut iter = reader.iter(&events); // `i: 2` event is returned twice! The `i: 1` event is missed. assert_eq!(iter.next(), Some(&TestEvent { i: 2 })); assert_eq!(iter.next(), None); } ``` I don't think this can be fixed without adding some very convoluted bookkeeping. ## Migration Guide `ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s. Co-authored-by: devil-ira <[email protected]>
- Loading branch information
1 parent
386763e
commit 32023a5
Showing
3 changed files
with
8 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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