bevy/crates/bevy_gizmos/src
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
..
primitives Use u32 for all resolution/subdivision fields in bevy_gizmos (#13927) 2024-06-19 17:28:10 +00:00
aabb.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
arcs.rs Use u32 for all resolution/subdivision fields in bevy_gizmos (#13927) 2024-06-19 17:28:10 +00:00
arrows.rs Add axes_2d gizmo. (#12334) 2024-06-04 00:02:38 +00:00
circles.rs Fix intra-doc links and make CI test them (#14076) 2024-07-11 13:08:31 +00:00
config.rs #12502 Remove limit on RenderLayers. (#13317) 2024-05-16 16:15:47 +00:00
cross.rs Add cross gizmos (#13883) 2024-06-17 15:45:32 +00:00
gizmos.rs Rename Rotation2d to Rot2 (#13694) 2024-06-05 21:51:13 +00:00
grid.rs Add cross gizmos (#13883) 2024-06-17 15:45:32 +00:00
lib.rs plugin_group! macro (adopted) (#14339) 2024-07-16 01:14:33 +00:00
light.rs Make gizmos take primitives by ref (#13534) 2024-05-27 13:48:47 +00:00
line_joints.wgsl Normalise matrix naming (#13489) 2024-06-03 16:56:53 +00:00
lines.wgsl view.inverse_clip_from_world should be world_from_clip (#13756) 2024-06-09 14:40:14 +00:00
pipeline_2d.rs Make render phases render world resources instead of components. (#13277) 2024-05-21 18:23:04 +00:00
pipeline_3d.rs Make render phases render world resources instead of components. (#13277) 2024-05-21 18:23:04 +00:00
rounded_box.rs Use u32 for all resolution/subdivision fields in bevy_gizmos (#13927) 2024-06-19 17:28:10 +00:00