SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 59 Rust

Allow plugin functions in `plugin_group!` (#24345)

# Objective

Allow plugin functions to be used inside `plugin_group!` declarations.

Right now, functions of signature `fn(&mut App)` implement `Plugin`, but
cannot be added to plugin groups, due
to how the macro is implemented.

This fixes that.

## Solution

This PR fixes the problem by introducing a block after the top-level
members, labeled with `fn`, where the names are considered to be
referencing values directly, rather than types. It looks like:

```rust
plugin_group! {
  pub struct MyFnGroup {
     // ... stuff that `impl Plugin` ...
     fn {
       :local_fn,
       outer:::outer_fn,
       #[doc(hidden)]
       internal:::hidden_fn,
    }
  }
}
```

## Testing

I edited the doctest above the macro implementation, and made sure that
passes, and the syntax is non-invasive otherwise, so overall, not much
should change.

---

---------

Co-authored-by: DavidCrossman <22548398+DavidCrossman@users.noreply.github.com>
Co-authored-by: Niklas Eicker <git@nikl.me>
U
Uche Okwo committed
646cf22b9174b96557f7c8797de5a689a2304974
Parent: d3dd1f9
Committed by GitHub <noreply@github.com> on 5/23/2026, 8:04:56 AM