-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Use an opaque type for EntityCommand::with_entity
#11210
Conversation
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
Your PR increases Bevy Minimum Supported Rust Version. Please update the |
1 similar comment
Your PR increases Bevy Minimum Supported Rust Version. Please update the |
Just wanted to know if it is ok to use |
I think the main reason this use is discouraged is due to weirdness surrounding |
On further consideration I don't think this is a breaking change. It was not possible to construct or use the |
Objective
The trait method
with_entity
is used to add anEntityCommand
to the command queue. Currently this method returnsWithEntity<C>
which pairs a command with anEntity
. By replacing this explicit type with an opaque type, implementors can override this default implementation by returning a custom command or closure that does the same thing with a lower memory footprint.Solution
Return an opaque type from the method. As a bonus this file is now cleaner without the
WithEntity
boilerplate