mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
5f0abbfd15
# Objective I ran into a case where I need to create a `CommandQueue` and push standard `Command` actions like `Insert` or `Remove` to it manually. I saw that `Remove` looked as follows: ```rust struct Remove<T> { entity: Entity, phantom: PhantomData<T> } ``` so naturally, I tried to use `Remove::<Foo>::from(entity)` but it didn't exist. We need to specify the `PhantomData` explicitly when creating this command action. The same goes for `RemoveResource` and `InitResource` ## Solution This PR implements the following: - `From<Entity>` for `Remove<T>` - `Default` for `RemoveResource` and `InitResource` - use these traits in the implementation of methods of `Commands` - rename `phantom` field on the structs above to `_phantom` to have a more uniform field naming scheme for the command actions --- ## Changelog > This section is optional. If this was a trivial fix, or has no externally-visible impact, you can delete this section. - Added: implemented `From<Entity>` for `Remove<T>` and `Default` for `RemoveResource` and `InitResource` for ergonomics --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_reflect_compile_fail_tests | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |