bevy/crates/bevy_ecs/src/system
Lars Frost dcbd30200e
Make names of closure systems changable (#14369)
# Objective

When using tracing or
[`bevy_mod_debugdump`](https://github.com/jakobhellermann/bevy_mod_debugdump),
the names of function systems produced by closures are either ambiguous
(like `game::mainapp::{closure}` when tracing) or too long
(`bevy_mod_debugdump` includes full type signature if no name given),
which makes debugging with tracing difficult.

## Solution
Add a function `with_name` to rename a system. The proposed API can be
used in the following way:
```rust
app
    .add_systems(Startup, IntoSystem::into_system(|name: SystemName| {
        println!("System name: {}", name.name().to_owned());
    }).with_name("print_test_system"));
```

## Testing
- There is a test in
`bevy_ecs::system:system_name::test_closure_system_name_regular_param`
2024-07-18 18:07:47 +00:00
..
commands Add insert_by_id and try_insert_by_id to EntityCommands (#14283) 2024-07-15 23:29:13 +00:00
adapter_system.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00
builder.rs Implement a SystemBuilder for building SystemParams (#13123) 2024-05-22 00:58:37 +00:00
combinator.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00
exclusive_function_system.rs Make names of closure systems changable (#14369) 2024-07-18 18:07:47 +00:00
exclusive_system_param.rs Add on_unimplemented Diagnostics to Most Public Traits (#13347) (#13662) 2024-06-04 00:31:34 +00:00
function_system.rs Make names of closure systems changable (#14369) 2024-07-18 18:07:47 +00:00
mod.rs Fix error in AnyOf (#14027) 2024-06-27 20:20:50 +00:00
observer_system.rs Allow observer systems to have outputs (#14159) 2024-07-15 14:59:12 +00:00
query.rs Fix typo in Query::single_mut docs (#13916) 2024-06-18 19:55:37 +00:00
system.rs Generalised ECS reactivity with Observers (#10839) 2024-06-15 01:33:26 +00:00
system_name.rs Make names of closure systems changable (#14369) 2024-07-18 18:07:47 +00:00
system_param.rs Fixed #14248 and other URL issues (#14276) 2024-07-11 12:01:49 +00:00
system_registry.rs Better SystemId to Entity conversions (#13090) 2024-04-25 18:47:49 +00:00