Skip to content

Commit

Permalink
Remove APIs deprecated in 0.9 (bevyengine#6801)
Browse files Browse the repository at this point in the history
# Objective
These functions were deprecated in 0.9. They should be removed in 0.10.

## Solution
Remove them.
  • Loading branch information
james7132 authored and ickshonpe committed Dec 6, 2022
1 parent 262e4a0 commit 517447a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 75 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub(crate) struct SpawnBundleStatus;
impl BundleComponentStatus for SpawnBundleStatus {
#[inline]
unsafe fn get_status(&self, _index: usize) -> ComponentStatus {
// Components added during a spawn_bundle call are always treated as added
// Components added during a spawn call are always treated as added
ComponentStatus::Added
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ mod tests {
}

#[test]
fn remove_bundle() {
fn remove() {
let mut world = World::default();
world.spawn((A(1), B(1), TableStored("1")));
let e2 = world.spawn((A(2), B(2), TableStored("2"))).id();
Expand Down
31 changes: 1 addition & 30 deletions crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,6 @@ impl<'w, 's> Commands<'w, 's> {
e
}

#[deprecated(
since = "0.9.0",
note = "Use `spawn` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
pub fn spawn_bundle<'a, T: Bundle>(&'a mut self, bundle: T) -> EntityCommands<'w, 's, 'a> {
let mut e = self.spawn_empty();
e.insert(bundle);
e
}

/// Returns the [`EntityCommands`] for the requested [`Entity`].
///
/// # Panics
Expand Down Expand Up @@ -397,7 +387,7 @@ impl<'w, 's> Commands<'w, 's> {
///
/// This method is equivalent to iterating `bundles_iter`,
/// calling [`get_or_spawn`](Self::get_or_spawn) for each bundle,
/// and passing it to [`insert_bundle`](EntityCommands::insert_bundle),
/// and passing it to [`insert`](EntityCommands::insert),
/// but it is faster due to memory pre-allocation.
///
/// # Note
Expand Down Expand Up @@ -620,14 +610,6 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
self
}

#[deprecated(
since = "0.9.0",
note = "Use `insert` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
pub fn insert_bundle(&mut self, bundle: impl Bundle) -> &mut Self {
self.insert(bundle)
}

/// Removes a [`Bundle`] of components from the entity.
///
/// See [`EntityMut::remove`](crate::world::EntityMut::remove) for more
Expand Down Expand Up @@ -677,17 +659,6 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
self
}

#[deprecated(
since = "0.9.0",
note = "Use `remove` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
pub fn remove_bundle<T>(&mut self) -> &mut Self
where
T: Bundle,
{
self.remove::<T>()
}

/// Despawns the entity.
///
/// See [`World::despawn`] for more details.
Expand Down
24 changes: 0 additions & 24 deletions crates/bevy_ecs/src/world/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,6 @@ impl<'w> EntityMut<'w> {
})
}

#[deprecated(
since = "0.9.0",
note = "Use `insert` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
pub fn insert_bundle<T: Bundle>(&mut self, bundle: T) -> &mut Self {
self.insert(bundle)
}

/// Adds a [`Bundle`] of components to the entity.
///
/// This will overwrite any previous value(s) of the same component type.
Expand All @@ -294,14 +286,6 @@ impl<'w> EntityMut<'w> {
self
}

#[deprecated(
since = "0.9.0",
note = "Use `remove` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
pub fn remove_bundle<T: Bundle>(&mut self) -> Option<T> {
self.remove::<T>()
}

// TODO: move to BundleInfo
/// Removes a [`Bundle`] of components from the entity and returns the bundle.
///
Expand Down Expand Up @@ -430,14 +414,6 @@ impl<'w> EntityMut<'w> {
entities.set(entity.index(), new_location);
}

#[deprecated(
since = "0.9.0",
note = "Use `remove_intersection` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
pub fn remove_bundle_intersection<T: Bundle>(&mut self) {
self.remove_intersection::<T>();
}

// TODO: move to BundleInfo
/// Remove any components in the bundle that the entity has.
pub fn remove_intersection<T: Bundle>(&mut self) {
Expand Down
20 changes: 1 addition & 19 deletions crates/bevy_hierarchy/src/child_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,6 @@ pub struct ChildBuilder<'w, 's, 'a> {
}

impl<'w, 's, 'a> ChildBuilder<'w, 's, 'a> {
/// Spawns an entity with the given bundle and inserts it into the children defined by the [`ChildBuilder`]
#[deprecated(
since = "0.9.0",
note = "Use `spawn` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
pub fn spawn_bundle(&mut self, bundle: impl Bundle) -> EntityCommands<'w, 's, '_> {
self.spawn(bundle)
}

/// Spawns an entity with the given bundle and inserts it into the children defined by the [`ChildBuilder`]
pub fn spawn(&mut self, bundle: impl Bundle) -> EntityCommands<'w, 's, '_> {
let e = self.commands.spawn(bundle);
Expand Down Expand Up @@ -286,7 +277,7 @@ pub trait BuildChildren {
///
/// parent_commands.insert(SomethingElse);
/// commands.entity(child_id).with_children(|parent| {
/// parent.spawn_bundle(MoreStuff);
/// parent.spawn(MoreStuff);
/// });
/// # }
/// ```
Expand Down Expand Up @@ -411,15 +402,6 @@ impl<'w> WorldChildBuilder<'w> {
self.world.entity_mut(entity)
}

#[deprecated(
since = "0.9.0",
note = "Use `spawn` instead, which now accepts bundles, components, and tuples of bundles and components."
)]
/// Spawns an entity with the given bundle and inserts it into the children defined by the [`WorldChildBuilder`]
pub fn spawn_bundle(&mut self, bundle: impl Bundle + Send + Sync + 'static) -> EntityMut<'_> {
self.spawn(bundle)
}

/// Spawns an [`Entity`] with no components and inserts it into the children defined by the [`WorldChildBuilder`] which adds the [`Parent`] component to it.
pub fn spawn_empty(&mut self) -> EntityMut<'_> {
let entity = self.world.spawn(Parent(self.parent)).id();
Expand Down

0 comments on commit 517447a

Please sign in to comment.