Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information