bevy/crates
Carter Anderson cd15f0f5be Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039)
# Objective

Take advantage of the "impl Bundle for Component" changes in #2975 / add the follow up changes discussed there.

## Solution

- Change `insert` and `remove` to accept a Bundle instead of a Component (for both Commands and World)
- Deprecate `insert_bundle`, `remove_bundle`, and `remove_bundle_intersection`
- Add `remove_intersection`

---

## Changelog

- Change `insert` and `remove` now accept a Bundle instead of a Component (for both Commands and World)
- `insert_bundle` and `remove_bundle` are deprecated
 

## Migration Guide

Replace `insert_bundle` with `insert`:
```rust
// Old (0.8)
commands.spawn().insert_bundle(SomeBundle::default());
// New (0.9)
commands.spawn().insert(SomeBundle::default());
```

Replace `remove_bundle` with `remove`:
```rust
// Old (0.8)
commands.entity(some_entity).remove_bundle::<SomeBundle>();
// New (0.9)
commands.entity(some_entity).remove::<SomeBundle>();
```

Replace `remove_bundle_intersection` with `remove_intersection`:
```rust
// Old (0.8)
world.entity_mut(some_entity).remove_bundle_intersection::<SomeBundle>();
// New (0.9)
world.entity_mut(some_entity).remove_intersection::<SomeBundle>();
```

Consider consolidating as many operations as possible to improve ergonomics and cut down on archetype moves:
```rust
// Old (0.8)
commands.spawn()
  .insert_bundle(SomeBundle::default())
  .insert(SomeComponent);

// New (0.9) - Option 1
commands.spawn().insert((
  SomeBundle::default(),
  SomeComponent,
))

// New (0.9) - Option 2
commands.spawn_bundle((
  SomeBundle::default(),
  SomeComponent,
))
```

## Next Steps

Consider changing `spawn` to accept a bundle and deprecate `spawn_bundle`.
2022-09-21 21:47:53 +00:00
..
bevy_animation Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_app Remove unused dependency from bevy_app (#5894) 2022-09-06 15:06:18 +00:00
bevy_asset Remove AssetServer::watch_for_changes() (#5968) 2022-09-19 16:36:38 +00:00
bevy_audio Update rodio requirement from 0.15 to 0.16 (#6020) 2022-09-19 13:56:56 +00:00
bevy_core Swap out num_cpus for std:🧵:available_parallelism (#4970) 2022-09-19 15:46:03 +00:00
bevy_core_pipeline Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_diagnostic Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_dylib Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_dynamic_plugin Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_ecs Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_ecs_compile_fail_tests Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_encase_derive Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_gilrs Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_gltf Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_hierarchy Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_input Derived Copy trait for bevy_input events, Serialize/Deserialize for events in bevy_input and bevy_windows, PartialEq for events in both, and Eq where possible in both. (#6023) 2022-09-20 18:24:00 +00:00
bevy_internal Derived Copy trait for bevy_input events, Serialize/Deserialize for events in bevy_input and bevy_windows, PartialEq for events in both, and Eq where possible in both. (#6023) 2022-09-20 18:24:00 +00:00
bevy_log Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
bevy_macro_utils Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_math Expose mint feature in bevy_math/glam (#5857) 2022-09-03 03:02:04 +00:00
bevy_mikktspace Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_pbr Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_ptr Bump Version after Release (#5576) 2022-08-05 02:03:05 +00:00
bevy_reflect bevy_reflect: Improve serialization format even more (#5723) 2022-09-20 19:38:18 +00:00
bevy_render Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_scene bevy_reflect: Improve serialization format even more (#5723) 2022-09-20 19:38:18 +00:00
bevy_sprite Implement IntoIterator for &Extract<P> (#6025) 2022-09-20 00:29:10 +00:00
bevy_tasks Swap out num_cpus for std:🧵:available_parallelism (#4970) 2022-09-19 15:46:03 +00:00
bevy_text Register missing bevy_text types (#6029) 2022-09-19 22:50:35 +00:00
bevy_time Clarify that Stopwatch.reset does not affect paused state (#6016) 2022-09-18 23:36:05 +00:00
bevy_transform Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_ui Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
bevy_utils Remove Sync bound from Local (#5483) 2022-09-12 04:15:55 +00:00
bevy_window Derived Copy trait for bevy_input events, Serialize/Deserialize for events in bevy_input and bevy_windows, PartialEq for events in both, and Eq where possible in both. (#6023) 2022-09-20 18:24:00 +00:00
bevy_winit disable window pre creation for ios (#5883) 2022-09-06 15:06:17 +00:00