Added peeking to EventReader
Added peekability to EventReader for when you want to view an event but not mark it as read
Objective
- Allow the ability to view an event without marking it as read
Solution
- Copied the existing iterators and implemented them for peeking, ie. they no longer move the "last_read" onwards.
- I also took this opportunity to improve the documentation on EventReader given I was adding explanations for peeking.
Testing
- Wrote a number of tests to confirm that the new peek iterators work as expected. Renamed a bunch of the existing tests to specify they test read and wrote peek equivalents. Also wrote tests for combination of reading and peeking to make sure behavior was as expected.
No idea why the MacOS build fails given I didn't touch those files at all?
The issue is that par_read doesn't mark events as seen like read which I assumed it did, I ended up rewriting the tests to validate that behavior. Which par_read then failed.
It looks like this has always been the behavior of par_read
Added the fix from #13836 to this pull request too given I'm going to squash the files and tests associated with it.
I'm marking this as blocked by #13836. Once that gets merged and this gets enough reviews, this can be merged :)
@BD103 I wouldn’t say this is blocked. In fact. This has the fix in it already so if this is merged the other PR doesn’t need to be.
Failed because of a formatting requirement that I can’t really fix on my phone. Will take a look tomorrow.
@BD103 I wouldn’t say this is blocked. In fact. This has the fix in it already so if this is merged the other PR doesn’t need to be.
I would prefer we split it up into two different PRs, but I'll defer to maintainers on this. :)
Only reason I included it in here is because I squash the existing iterator file anyway.
This branch is now stacked on top of https://github.com/bevyengine/bevy/pull/13818
Completed in https://github.com/bevyengine/bevy/pull/13818