bevy/crates/bevy_ecs/src
Stefan Seemayer 21ac4bc0ae impl Command for <impl FnOnce(&mut World)> (#2996)
This is my first contribution to this exciting project! Thanks so much for your wonderful work. If there is anything that I can improve about this PR, please let me know :)

# Objective

- Fixes #2899
- If a simple one-off command is needed to be added within a System, this simplifies that process so that we can simply do `commands.add(|world: &mut World| { /* code here */ })` instead of defining a custom type implementing `Command`.

## Solution

- This is achieved by `impl Command for F where F: FnOnce(&mut World) + Send + Sync + 'static` as just calling the function.

I am not sure if the bounds can be further relaxed but needed the whole `Send`, `Sync`, and `'static` to get it to compile.
2022-02-03 04:11:19 +00:00
..
entity Fix doc_markdown lints in bevy_ecs (#3473) 2022-01-06 00:43:37 +00:00
query docs: Fix private doc links and enable CI test (#3743) 2022-02-02 21:47:29 +00:00
schedule Add missing closing ticks for inline examples and some cleanup (#3573) 2022-01-07 09:25:12 +00:00
storage Fix doc_markdown lints in bevy_ecs (#3473) 2022-01-06 00:43:37 +00:00
system impl Command for <impl FnOnce(&mut World)> (#2996) 2022-02-03 04:11:19 +00:00
world docs: Fix private doc links and enable CI test (#3743) 2022-02-02 21:47:29 +00:00
archetype.rs Fix doc_markdown lints in bevy_ecs (#3473) 2022-01-06 00:43:37 +00:00
bundle.rs Fix doc_markdown lints in bevy_ecs (#3473) 2022-01-06 00:43:37 +00:00
change_detection.rs default features from bevy_asset and bevy_ecs can actually be disabled (#3097) 2021-11-13 21:15:22 +00:00
component.rs Remove ComponentsError (#3716) 2022-01-21 00:12:32 +00:00
event.rs Increment last event count on next instead of iter (#2382) 2022-02-02 02:29:33 +00:00
lib.rs Mark .id() methods which return an Entity as must_use (#3750) 2022-01-23 14:24:37 +00:00
reflect.rs Add FromReflect trait to convert dynamic types to concrete types (#1395) 2021-12-26 18:49:01 +00:00