bevy/crates/bevy_ecs/src/system
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
..
commands Commands::send_event (#14933) 2024-08-27 23:43:40 +00:00
adapter_system.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00
builder.rs SystemParamBuilder - Allow deriving a SystemParamBuilder struct when deriving SystemParam. (#14818) 2024-08-28 18:24:52 +00:00
combinator.rs Replace UnsafeCell<World> usage with UnsafeWorldCell in CombinatorSystem (#14706) 2024-08-11 13:58:10 +00:00
exclusive_function_system.rs Require &mut self for World::increment_change_tick (#14459) 2024-07-24 12:42:28 +00:00
exclusive_system_param.rs Use #[doc(fake_variadic)] to improve docs readability (#14703) 2024-08-12 18:54:33 +00:00
function_system.rs SystemParamBuilder - Enable type inference of closure parameter when building dynamic systems (#14820) 2024-08-28 01:37:52 +00:00
mod.rs Required Components (#14791) 2024-08-27 20:22:23 +00:00
observer_system.rs Added on_unimplemented Diagnostic for IntoObserverSystem (#14840) 2024-08-25 14:15:49 +00:00
query.rs Add query reborrowing (#14690) 2024-08-15 17:38:56 +00:00
system_name.rs Make names of closure systems changable (#14369) 2024-07-18 18:07:47 +00:00
system_param.rs SystemParamBuilder - Allow deriving a SystemParamBuilder struct when deriving SystemParam. (#14818) 2024-08-28 18:24:52 +00:00
system_registry.rs add SystemIdMarker Component to enable filtering for SystemId Entitys (#14584) 2024-08-12 16:11:06 +00:00
system.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00