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

Support component hooks closures #16371

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mnmaita
Copy link
Member

@mnmaita mnmaita commented Nov 13, 2024

Objective

Solution

  • Updated the Component macro to accept closures for ComponentHooks.

Testing

  • Compiled locally and tested by altering the component_hooks example.

@mnmaita
Copy link
Member Author

mnmaita commented Nov 13, 2024

I still have some outstanding questions regarding this change:

  • Is the example update any good? Or should I consider doing a "full rework" where we actually showcase the three ways of adding hooks to components in the actual code?
  • Should we consolidate RequiredFunc and HookFunc enums since they are essentially the same? I went for a simpler approach but was thinking on creating some DeriveFunc (or similar) to cover both cases and avoid code repetition.

@mnmaita mnmaita added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Macros Code that generates Rust code labels Nov 13, 2024
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 D-Macros Code that generates Rust code D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant