bevy/crates
BD103 c3057d4353
plugin_group! macro (adopted) (#14339)
# Objective

- Adopted from #11460.
- Closes #7332.
- The documentation for `DefaultPlugins` and `MinimalPlugins` frequently
goes out of date because it is not .

## Solution

- Create a macro, `plugin_group!`, to automatically create
`PluginGroup`s and document them.

## Testing

- Run `cargo-expand` on the generated code for `DefaultPlugins` and
`MinimalPlugins`.
- Try creating a custom plugin group with the macro.

---

## Showcase

- You can now define custom `PluginGroup`s using the `plugin_group!`
macro.

```rust
plugin_group! {
    /// My really cool plugic group!
    pub struct MyPluginGroup {
        physics:::PhysicsPlugin,
        rendering:::RenderingPlugin,
        ui:::UiPlugin,
    }
}
```

<details>
  <summary>Expanded output</summary>

```rust
/// My really cool plugic group!
///
/// - [`PhysicsPlugin`](physics::PhysicsPlugin)
/// - [`RenderingPlugin`](rendering::RenderingPlugin)
/// - [`UiPlugin`](ui::UiPlugin)
pub struct MyPluginGroup;
impl ::bevy_app::PluginGroup for MyPluginGroup {
    fn build(self) -> ::bevy_app::PluginGroupBuilder {
        let mut group = ::bevy_app::PluginGroupBuilder::start::<Self>();
        {
            const _: () = {
                const fn check_default<T: Default>() {}
                check_default::<physics::PhysicsPlugin>();
            };
            group = group.add(<physics::PhysicsPlugin>::default());
        }
        {
            const _: () = {
                const fn check_default<T: Default>() {}
                check_default::<rendering::RenderingPlugin>();
            };
            group = group.add(<rendering::RenderingPlugin>::default());
        }
        {
            const _: () = {
                const fn check_default<T: Default>() {}
                check_default::<ui::UiPlugin>();
            };
            group = group.add(<ui::UiPlugin>::default());
        }
        group
    }
}
```

</details>

---------

Co-authored-by: Doonv <58695417+doonv@users.noreply.github.com>
Co-authored-by: Mateusz Wachowiak <mateusz_wachowiak@outlook.com>
2024-07-16 01:14:33 +00:00
..
bevy_a11y plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_animation Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_app plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_asset add debug logging to ascertain the base path the asset server is using (#13820) 2024-07-15 14:00:43 +00:00
bevy_audio Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_color Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_core Rename bevy_core::name::DebugName to bevy_core::name::NameOrEntity (#14211) 2024-07-15 15:21:41 +00:00
bevy_core_pipeline Fix error/typo in SMAA shader (#14338) 2024-07-15 23:40:39 +00:00
bevy_derive Specify test group names in github summary for compile fail tests (#14330) 2024-07-15 16:13:03 +00:00
bevy_dev_tools plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_diagnostic Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_dylib Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_dynamic_plugin Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_ecs Add insert_by_id and try_insert_by_id to EntityCommands (#14283) 2024-07-15 23:29:13 +00:00
bevy_encase_derive Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_gilrs Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_gizmos plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_gltf Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_hierarchy Minimal Bubbling Observers (#13991) 2024-07-15 13:39:41 +00:00
bevy_input Expose Winit's KeyEvent::repeat in KeyboardInput (#14161) 2024-07-15 14:52:33 +00:00
bevy_internal plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_log Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_macro_utils Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_math Implement Bounded2d for Annulus (#14326) 2024-07-15 16:08:35 +00:00
bevy_mikktspace Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_pbr Faster MeshletMesh deserialization (#14193) 2024-07-15 15:06:02 +00:00
bevy_picking Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_ptr Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_reflect Specify test group names in github summary for compile fail tests (#14330) 2024-07-15 16:13:03 +00:00
bevy_render Clearer spatial bundle pub const docs (#14293) 2024-07-15 16:03:09 +00:00
bevy_scene Align Scene::write_to_world_with to match DynamicScene::write_to_world_with (#13855) 2024-07-15 14:04:09 +00:00
bevy_sprite Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_state plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
bevy_tasks Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_text Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
bevy_time Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_transform Clarify GlobalTransform::transform_point (#14292) 2024-07-15 15:59:29 +00:00
bevy_ui Clean up UiSystem system sets (#14228) 2024-07-15 15:27:38 +00:00
bevy_utils Bump Version after Release (#14219) 2024-07-08 12:54:08 +00:00
bevy_window Remove unused default feature from bevy_window (#14313) 2024-07-15 16:49:00 +00:00
bevy_winit Expose Winit's KeyEvent::repeat in KeyboardInput (#14161) 2024-07-15 14:52:33 +00:00