bevy/crates/bevy_ui/src
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
..
flex Query filter types must be ReadOnlyWorldQuery (#6008) 2022-09-18 23:52:01 +00:00
render Accept Bundles for insert and remove. Deprecate insert/remove_bundle (#6039) 2022-09-21 21:47:53 +00:00
widget Limit FontAtlasSets (#5708) 2022-09-19 16:12:12 +00:00
entity.rs Improve ergonomics and reduce boilerplate around creating text elements. (#5343) 2022-07-20 14:14:29 +00:00
focus.rs bevy_reflect: Update enum derives (#5473) 2022-08-02 22:40:29 +00:00
geometry.rs Add AUTO and UNDEFINED const constructors for Size (#5761) 2022-08-22 23:08:08 +00:00
lib.rs Add UI scaling (#5814) 2022-08-29 23:35:53 +00:00
ui_node.rs Move sprite::Rect into bevy_math (#5686) 2022-09-02 12:35:23 +00:00
update.rs Remove last uses of string-labels (#5420) 2022-09-03 18:06:41 +00:00