bevy/crates/bevy_ecs/macros/src
Giacomo Stevanato 35166d9029
Refactor bundle derive (#19749)
# Objective

- Splitted off from  #19491
- Make adding generated code to the `Bundle` derive macro easier
- Fix a bug when multiple fields are `#[bundle(ignore)]`

## Solution

- Instead of accumulating the code for each method in a different `Vec`,
accumulate only the names of non-ignored fields and their types, then
use `quote` to generate the code for each of them in the method body.
- To fix the bug, change the code populating the `BundleFieldKind` to
push only one of them per-field (previously each `#[bundle(ignore)]`
resulted in pushing twice, once for the correct
`BundleFieldKind::Ignore` and then again unconditionally for
`BundleFieldKind::Component`)

## Testing

- Added a regression test for the bug that was fixed
2025-06-20 16:36:08 +00:00
..
component.rs Event Split: Event, EntityEvent, and BufferedEvent (#19647) 2025-06-15 16:46:34 +00:00
lib.rs Refactor bundle derive (#19749) 2025-06-20 16:36:08 +00:00
query_data.rs Fix QueryData derive codegen (#19750) 2025-06-20 15:48:16 +00:00
query_filter.rs Remove 's lifetime from WorldQuery::Fetch (#19720) 2025-06-19 00:58:21 +00:00
world_query.rs Remove 's lifetime from WorldQuery::Fetch (#19720) 2025-06-19 00:58:21 +00:00