bevy/crates/bevy_ecs/src
Chris Russell 4be8e497ca
SystemParamBuilder - Allow deriving a SystemParamBuilder struct when deriving SystemParam. (#14818)
# Objective

Allow `SystemParamBuilder` implementations for custom system parameters
created using `#[derive(SystemParam)]`.

## Solution

Extend the derive macro to accept a `#[system_param(builder)]`
attribute. When present, emit a builder type with a field corresponding
to each field of the param.

## Example

```rust
#[derive(SystemParam)]
#[system_param(builder)]
struct CustomParam<'w, 's> {
    query: Query<'w, 's, ()>,
    local: Local<'s, usize>,
}

let system = (CustomParamBuilder {
    local: LocalBuilder(100),
    query: QueryParamBuilder::new(|builder| {
        builder.with::<A>();
    }),
},)
    .build_state(&mut world)
    .build_system(|param: CustomParam| *param.local + param.query.iter().count());
```
2024-08-28 18:24:52 +00:00
..
entity Required Components (#14791) 2024-08-27 20:22:23 +00:00
event Commands::send_event (#14933) 2024-08-27 23:43:40 +00:00
identifier feat: Reflection implementations on Identifier (#13648) 2024-06-03 16:33:14 +00:00
observer Implement std::fmt::Debug for ecs::observer::Trigger (#14857) 2024-08-25 16:55:54 +00:00
query Fix query transmute from table to archetype iteration unsoundness (#14615) 2024-08-27 00:58:40 +00:00
reflect Use map_unchanged in reflection instead of creating a Mut manually. (#14692) 2024-08-15 14:26:57 +00:00
schedule Add condition_changed and condition_became_true to common_conditions (#14917) 2024-08-26 18:32:44 +00:00
storage Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
system SystemParamBuilder - Allow deriving a SystemParamBuilder struct when deriving SystemParam. (#14818) 2024-08-28 18:24:52 +00:00
world Updated FromWorld Documentation to mention Default (#14954) 2024-08-28 11:37:31 +00:00
archetype.rs Required Components (#14791) 2024-08-27 20:22:23 +00:00
batching.rs Parallel event reader (#12554) 2024-04-22 16:37:42 +00:00
bundle.rs Required Components (#14791) 2024-08-27 20:22:23 +00:00
change_detection.rs Add filter_map_unchanged to Mut<T> (#14837) 2024-08-22 17:51:21 +00:00
component.rs Required Components (#14791) 2024-08-27 20:22:23 +00:00
intern.rs Moves intern and label modules into bevy_ecs (#12772) 2024-04-08 15:34:11 +00:00
label.rs Add mappings to EntityMapper (#13727) 2024-06-08 12:52:23 +00:00
lib.rs Required Components (#14791) 2024-08-27 20:22:23 +00:00
removal_detection.rs Created an EventMutator for when you want to mutate an event before reading (#13818) 2024-07-08 14:53:06 +00:00
traversal.rs Minimal Bubbling Observers (#13991) 2024-07-15 13:39:41 +00:00