Skip to content
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] - Tidy up the code of events #4713

Closed
wants to merge 8 commits into from

Conversation

DJMcNab
Copy link
Member

@DJMcNab DJMcNab commented May 10, 2022

Objective

  • The code in events.rs was a bit messy. There was lots of duplication between EventReader and ManualEventReader, and the state management code is not needed.

Solution

  • Clean it up.

Future work

Should we remove the type parameter from ManualEventReader?
It doesn't have any meaning outside of its source Events. But there's no real reason why it needs to have a type parameter - it's just plain data. I didn't remove it yet to keep the type safety in some of the users of it (primarily related to &mut World usage)

@DJMcNab DJMcNab changed the title Sweep swoop Tidy up the code of events May 10, 2022
@DJMcNab DJMcNab added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change labels May 10, 2022
@IceSentry
Copy link
Contributor

I would also suggest moving the impl EventReader block closer to the struct declaration. It's the only one in the file that doesn't follow this pattern and it feels a bit weird.

Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like that EventReader uses ManualEventReader internally and that EventSequence is nice too

@IceSentry IceSentry 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 May 10, 2022
@alice-i-cecile
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request May 10, 2022
# Objective

- The code in `events.rs` was a bit messy. There was lots of duplication between `EventReader` and `ManualEventReader`, and the state management code is not needed.

## Solution

- Clean it up.

## Future work

Should we remove the type parameter from `ManualEventReader`? 
It doesn't have any meaning outside of its source `Events`. But there's no real reason why it needs to have a type parameter - it's just plain data. I didn't remove it yet to keep the type safety in some of the users of it (primarily related to `&mut World` usage)
@bors bors bot changed the title Tidy up the code of events [Merged by Bors] - Tidy up the code of events May 10, 2022
@bors bors bot closed this May 10, 2022
@DJMcNab DJMcNab deleted the sweep_swoop branch May 10, 2022 20:53
robtfm pushed a commit to robtfm/bevy that referenced this pull request May 17, 2022
# Objective

- The code in `events.rs` was a bit messy. There was lots of duplication between `EventReader` and `ManualEventReader`, and the state management code is not needed.

## Solution

- Clean it up.

## Future work

Should we remove the type parameter from `ManualEventReader`? 
It doesn't have any meaning outside of its source `Events`. But there's no real reason why it needs to have a type parameter - it's just plain data. I didn't remove it yet to keep the type safety in some of the users of it (primarily related to `&mut World` usage)
exjam pushed a commit to exjam/bevy that referenced this pull request May 22, 2022
# Objective

- The code in `events.rs` was a bit messy. There was lots of duplication between `EventReader` and `ManualEventReader`, and the state management code is not needed.

## Solution

- Clean it up.

## Future work

Should we remove the type parameter from `ManualEventReader`? 
It doesn't have any meaning outside of its source `Events`. But there's no real reason why it needs to have a type parameter - it's just plain data. I didn't remove it yet to keep the type safety in some of the users of it (primarily related to `&mut World` usage)
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
# Objective

- The code in `events.rs` was a bit messy. There was lots of duplication between `EventReader` and `ManualEventReader`, and the state management code is not needed.

## Solution

- Clean it up.

## Future work

Should we remove the type parameter from `ManualEventReader`? 
It doesn't have any meaning outside of its source `Events`. But there's no real reason why it needs to have a type parameter - it's just plain data. I didn't remove it yet to keep the type safety in some of the users of it (primarily related to `&mut World` usage)
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-Code-Quality A section of code that is hard to understand or change 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