bevy/crates
Paweł Grabarz 07ed1d053e Implement and require #[derive(Component)] on all component structs (#2254)
This implements the most minimal variant of #1843 - a derive for marker trait. This is a prerequisite to more complicated features like statically defined storage type or opt-out component reflection.

In order to make component struct's purpose explicit and avoid misuse, it must be annotated with `#[derive(Component)]` (manual impl is discouraged for compatibility). Right now this is just a marker trait, but in the future it might be expanded. Making this change early allows us to make further changes later without breaking backward compatibility for derive macro users.

This already prevents a lot of issues, like using bundles in `insert` calls. Primitive types are no longer valid components as well. This can be easily worked around by adding newtype wrappers and deriving `Component` for them.

One funny example of prevented bad code (from our own tests) is when an newtype struct or enum variant is used. Previously, it was possible to write `insert(Newtype)` instead of `insert(Newtype(value))`. That code compiled, because function pointers (in this case newtype struct constructor) implement `Send + Sync + 'static`, so we allowed them to be used as components. This is no longer the case and such invalid code will trigger a compile error.


Co-authored-by: = <=>
Co-authored-by: TheRawMeatball <therawmeatball@gmail.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-10-03 19:23:44 +00:00
..
bevy_app Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_asset Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_audio Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_core Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_derive Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_diagnostic add get_history function to Diagnostic (#2772) 2021-09-06 19:16:08 +00:00
bevy_dylib Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_dynamic_plugin Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_ecs Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_gilrs Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_gltf Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_input Add convenience methods for checking a set of inputs (#2760) 2021-09-01 21:21:41 +00:00
bevy_internal Add trace_tracy feature for Tracy profiling (#2832) 2021-09-16 23:39:22 +00:00
bevy_log Add trace_tracy feature for Tracy profiling (#2832) 2021-09-16 23:39:22 +00:00
bevy_macro_utils Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_math Update glam requirement from 0.17.3 to 0.18.0 (#2748) 2021-09-06 18:49:40 +00:00
bevy_pbr Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_reflect Nightly clippy fixes (#2702) 2021-09-09 16:41:21 +00:00
bevy_render Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_scene System Param Lifetime Split (#2605) 2021-08-15 20:51:53 +00:00
bevy_sprite Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_tasks Not me ... us (#2654) 2021-08-15 20:08:52 +00:00
bevy_text Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_transform Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_ui Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
bevy_utils derive Debug, Clone for FixedState (StableAHash) (#2694) 2021-08-24 01:31:39 +00:00
bevy_wgpu Nightly clippy fixes (#2702) 2021-09-09 16:41:21 +00:00
bevy_window unused deps? (#2809) 2021-09-16 09:37:12 +00:00
bevy_winit Fix scale_factor_override in the winit backend (#2784) 2021-09-10 18:46:16 +00:00