Skip to content

Conversation

Aceeri
Copy link
Member

@Aceeri Aceeri commented Aug 18, 2022

Objective

Solution

  • Create a custom Iterator type.

Changelog

  • oldest_id and get_event convenience methods added to Events<T>.

@IceSentry IceSentry added the A-ECS Entities, components, systems, and events label Aug 19, 2022
@alice-i-cecile alice-i-cecile added the C-Usability A targeted quality-of-life change that makes Bevy easier to use label Sep 2, 2022
@Aceeri Aceeri force-pushed the manual-event-iterator branch from ed9c4a4 to df18953 Compare December 21, 2022 22:57
Copy link
Member

@joseph-gio joseph-gio left a 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().

@Aceeri
Copy link
Member Author

Aceeri commented Dec 22, 2022

I think it somewhat makes sense in that events is basically a saved iterator, we aren't actually mutating Events<E> we are mutating the ManualEventReader, but shrug.

@joseph-gio
Copy link
Member

joseph-gio commented Dec 22, 2022

Mutating self makes perfect sense -- I just don't think the method that does it should be called iter. Anyway, that's not what this PR is about, I just thought I'd mention it.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Dec 22, 2022
Copy link
Member

@alice-i-cecile alice-i-cecile left a 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+

bors bot pushed a commit that referenced this pull request Dec 25, 2022
# 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.
@bors
Copy link
Contributor

bors bot commented Dec 25, 2022

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Dec 25, 2022
# 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.
@bors
Copy link
Contributor

bors bot commented Dec 25, 2022

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Dec 25, 2022
# 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.
@bors bors bot changed the title Rework manual event iterator so we can actually name the type [Merged by Bors] - Rework manual event iterator so we can actually name the type Dec 25, 2022
@bors bors bot closed this Dec 25, 2022
alradish pushed a commit to alradish/bevy that referenced this pull request Jan 22, 2023
…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.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants