mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
0c98f9a225
# Objective Fix #7584. ## Solution Add an abstraction for creating custom system combinators with minimal boilerplate. Use this to implement AND/OR combinators. Use this to simplify the implementation of `PipeSystem`. ## Example Feel free to bikeshed on the syntax. I chose the names `and_then`/`or_else` to emphasize the fact that these short-circuit, while I chose method syntax to empasize that the arguments are *not* treated equally. ```rust app.add_systems(( my_system.run_if(resource_exists::<R>().and_then(resource_equals(R(0)))), our_system.run_if(resource_exists::<R>().or_else(resource_exists::<S>())), )); ``` --- ## Todo - [ ] Decide on a syntax - [x] Write docs - [x] Write tests ## Changelog + Added the extension methods `.and_then(...)` and `.or_else(...)` to run conditions, which allows combining run conditions with short-circuiting behavior. + Added the trait `Combine`, which can be used with the new `CombinatorSystem` to create system combinators with custom behavior. |
||
---|---|---|
.. | ||
component_change_detection.rs | ||
custom_query_param.rs | ||
ecs_guide.rs | ||
event.rs | ||
fixed_timestep.rs | ||
generic_system.rs | ||
hierarchy.rs | ||
iter_combinations.rs | ||
nondeterministic_system_order.rs | ||
parallel_query.rs | ||
removal_detection.rs | ||
run_conditions.rs | ||
startup_system.rs | ||
state.rs | ||
system_closure.rs | ||
system_param.rs | ||
system_piping.rs | ||
timers.rs |