-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Make standard commands more ergonomic (in niche cases) #8249
Make standard commands more ergonomic (in niche cases) #8249
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
This is marginally nicer, but definitely a niche bit of the API. On the fence if the complexity here is worth it. Could we make constructor methods instead? I think that's a better spot on the complexity <-> ergonomics curve for a niche API. |
Not a big fan of |
I was a bit too hasty there 😅 Good catches! Thanks! |
Co-authored-by: Alice Cecile <[email protected]>
Oh right: this is also technically breaking because you renamed the phantom data field. I'd probably just revert that? I don't think it's appreciably better. |
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? |
Objective
I ran into a case where I need to create a
CommandQueue
and push standardCommand
actions likeInsert
orRemove
to it manually. I saw thatRemove
looked as follows:so naturally, I tried to use
Remove::<Foo>::from(entity)
but it didn't exist. We need to specify thePhantomData
explicitly when creating this command action. The same goes forRemoveResource
andInitResource
Solution
This PR implements the following:
From<Entity>
forRemove<T>
Default
forRemoveResource
andInitResource
Commands
phantom
field on the structs above to_phantom
to have a more uniform field naming scheme for the command actionsChangelog
From<Entity>
forRemove<T>
andDefault
forRemoveResource
andInitResource
for ergonomics