bevy/crates/bevy_ecs/src
JoJoJet 5472ea4a14
Improve encapsulation for commands and add docs (#8725)
# Objective

Several of our built-in `Command` types are too public:
- `GetOrSpawn` is public, even though it only makes sense to call it
from within `Commands::get_or_spawn`.
- `Remove` and `RemoveResource` contain public `PhantomData` marker
fields.

## Solution

Remove `GetOrSpawn` and use an anonymous command. Make the marker fields
private.

---

## Migration Guide

The `Command` types `Remove` and `RemoveResource` may no longer be
constructed manually.

```rust
// Before:
commands.add(Remove::<T> {
    entity: id,
    phantom: PhantomData,
});

// After:
commands.add(Remove::<T>::new(id));

// Before:
commands.add(RemoveResource::<T> { phantom: PhantomData });

// After:
commands.add(RemoveResource::<T>::new());
```

The command type `GetOrSpawn` has been removed. It was not possible to
use this type outside of `bevy_ecs`.
2023-05-31 16:45:46 +00:00
..
entity Make scene handling of entity references robust (#7335) 2023-05-01 15:49:27 +00:00
query Document query errors (#8692) 2023-05-30 14:41:14 +00:00
schedule Improve safety for the multi-threaded executor using UnsafeWorldCell (#8292) 2023-05-29 15:22:10 +00:00
storage Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
system Improve encapsulation for commands and add docs (#8725) 2023-05-31 16:45:46 +00:00
world Improve safety for the multi-threaded executor using UnsafeWorldCell (#8292) 2023-05-29 15:22:10 +00:00
archetype.rs Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
bundle.rs Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
change_detection.rs Fix a change detection test (#8605) 2023-05-16 01:41:24 +00:00
component.rs Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
event.rs Manually implement common traits for EventId (#8529) 2023-05-04 12:22:25 +00:00
lib.rs Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
reflect.rs Rename map_entities and map_specific_entities (#7570) 2023-05-01 21:40:19 +00:00
removal_detection.rs Use UnsafeWorldCell to increase code quality for SystemParam (#8174) 2023-04-01 15:45:07 +00:00