-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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] - Rework manual event iterator so we can actually name the type #5735
Conversation
ed9c4a4
to
df18953
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything here looks good to me.
In the future, I think we should consider renaming .iter()
. It always feels wrong and surprising that events.iter()
mutates events
, and it's especially surprising that for _ in &events
does not work. Borrowing from std::io::Read
, I think a potentially better name for that method would be .read()
.
I think it somewhat makes sense in that events is basically a saved iterator, we aren't actually mutating |
Mutating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the little utility methods (get_events
and friends) to the change log too? They're quite useful, but easy to overlook.
bors r+
# Objective - Be able to name the type that `ManualEventReader::iter/iter_with_id` returns and `EventReader::iter/iter_with_id` by proxy. Currently for the purpose of #5719 ## Solution - Create a custom `Iterator` type.
Build failed (retrying...): |
# Objective - Be able to name the type that `ManualEventReader::iter/iter_with_id` returns and `EventReader::iter/iter_with_id` by proxy. Currently for the purpose of #5719 ## Solution - Create a custom `Iterator` type.
Build failed (retrying...): |
# Objective - Be able to name the type that `ManualEventReader::iter/iter_with_id` returns and `EventReader::iter/iter_with_id` by proxy. Currently for the purpose of #5719 ## Solution - Create a custom `Iterator` type.
…gine#5735) # Objective - Be able to name the type that `ManualEventReader::iter/iter_with_id` returns and `EventReader::iter/iter_with_id` by proxy. Currently for the purpose of bevyengine#5719 ## Solution - Create a custom `Iterator` type.
…gine#5735) # Objective - Be able to name the type that `ManualEventReader::iter/iter_with_id` returns and `EventReader::iter/iter_with_id` by proxy. Currently for the purpose of bevyengine#5719 ## Solution - Create a custom `Iterator` type.
Objective
ManualEventReader::iter/iter_with_id
returns andEventReader::iter/iter_with_id
by proxy.Currently for the purpose of Add
IntoIterator
to &mut EventReader #5719Solution
Iterator
type.Changelog
oldest_id
andget_event
convenience methods added toEvents<T>
.