diff --git a/crates/bevy_ecs/src/schedule/executor/mod.rs b/crates/bevy_ecs/src/schedule/executor/mod.rs index b73ffdfd33928..38b85c1ca5ad7 100644 --- a/crates/bevy_ecs/src/schedule/executor/mod.rs +++ b/crates/bevy_ecs/src/schedule/executor/mod.rs @@ -18,7 +18,7 @@ use crate::{ component::{ComponentId, Tick}, error::{BevyError, ErrorContext, Result}, prelude::{IntoSystemSet, SystemSet}, - query::{Access, FilteredAccessSet}, + query::FilteredAccessSet, schedule::{BoxedCondition, InternedSystemSet, NodeId, SystemTypeSet}, system::{ScheduleSystem, System, SystemIn, SystemParamValidationError, SystemStateFlags}, world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, World}, @@ -162,12 +162,8 @@ impl System for ApplyDeferred { Cow::Borrowed("bevy_ecs::apply_deferred") } - fn component_access(&self) -> &Access { - // This system accesses no components. - const { &Access::new() } - } - fn component_access_set(&self) -> &FilteredAccessSet { + // This system accesses no components. const { &FilteredAccessSet::new() } } diff --git a/crates/bevy_ecs/src/system/adapter_system.rs b/crates/bevy_ecs/src/system/adapter_system.rs index 062fbb3d5b2cb..6caa002deb167 100644 --- a/crates/bevy_ecs/src/system/adapter_system.rs +++ b/crates/bevy_ecs/src/system/adapter_system.rs @@ -127,10 +127,6 @@ where self.name.clone() } - fn component_access(&self) -> &crate::query::Access { - self.system.component_access() - } - fn component_access_set( &self, ) -> &crate::query::FilteredAccessSet { diff --git a/crates/bevy_ecs/src/system/combinator.rs b/crates/bevy_ecs/src/system/combinator.rs index 18de14126338f..95fea44985817 100644 --- a/crates/bevy_ecs/src/system/combinator.rs +++ b/crates/bevy_ecs/src/system/combinator.rs @@ -4,7 +4,7 @@ use core::marker::PhantomData; use crate::{ component::{ComponentId, Tick}, prelude::World, - query::{Access, FilteredAccessSet}, + query::FilteredAccessSet, schedule::InternedSystemSet, system::{input::SystemInput, SystemIn, SystemParamValidationError}, world::unsafe_world_cell::UnsafeWorldCell, @@ -144,10 +144,6 @@ where self.name.clone() } - fn component_access(&self) -> &Access { - self.component_access_set.combined_access() - } - fn component_access_set(&self) -> &FilteredAccessSet { &self.component_access_set } @@ -363,10 +359,6 @@ where self.name.clone() } - fn component_access(&self) -> &Access { - self.component_access_set.combined_access() - } - fn component_access_set(&self) -> &FilteredAccessSet { &self.component_access_set } diff --git a/crates/bevy_ecs/src/system/exclusive_function_system.rs b/crates/bevy_ecs/src/system/exclusive_function_system.rs index f7e362a6709b9..1cbdb5b07d31b 100644 --- a/crates/bevy_ecs/src/system/exclusive_function_system.rs +++ b/crates/bevy_ecs/src/system/exclusive_function_system.rs @@ -1,6 +1,6 @@ use crate::{ component::{ComponentId, Tick}, - query::{Access, FilteredAccessSet}, + query::FilteredAccessSet, schedule::{InternedSystemSet, SystemSet}, system::{ check_system_change_tick, ExclusiveSystemParam, ExclusiveSystemParamItem, IntoSystem, @@ -87,11 +87,6 @@ where self.system_meta.name.clone() } - #[inline] - fn component_access(&self) -> &Access { - self.system_meta.component_access_set.combined_access() - } - #[inline] fn component_access_set(&self) -> &FilteredAccessSet { &self.system_meta.component_access_set diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs index d257a9f0799fe..7ad7f27e2bb89 100644 --- a/crates/bevy_ecs/src/system/function_system.rs +++ b/crates/bevy_ecs/src/system/function_system.rs @@ -1,7 +1,7 @@ use crate::{ component::{ComponentId, Tick}, prelude::FromWorld, - query::{Access, FilteredAccessSet}, + query::FilteredAccessSet, schedule::{InternedSystemSet, SystemSet}, system::{ check_system_change_tick, ReadOnlySystemParam, System, SystemIn, SystemInput, SystemParam, @@ -620,11 +620,6 @@ where self.system_meta.name.clone() } - #[inline] - fn component_access(&self) -> &Access { - self.system_meta.component_access_set.combined_access() - } - #[inline] fn component_access_set(&self) -> &FilteredAccessSet { &self.system_meta.component_access_set diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index 54e5a781ab3eb..91ba8660d4cbd 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -1166,7 +1166,9 @@ mod tests { x.initialize(&mut world); y.initialize(&mut world); - let conflicts = x.component_access().get_conflicts(y.component_access()); + let conflicts = x + .component_access_set() + .get_conflicts(y.component_access_set()); let b_id = world .components() .get_resource_id(TypeId::of::()) diff --git a/crates/bevy_ecs/src/system/observer_system.rs b/crates/bevy_ecs/src/system/observer_system.rs index b123301a08401..4891a39d4581c 100644 --- a/crates/bevy_ecs/src/system/observer_system.rs +++ b/crates/bevy_ecs/src/system/observer_system.rs @@ -6,7 +6,7 @@ use crate::{ error::Result, never::Never, prelude::{Bundle, Trigger}, - query::{Access, FilteredAccessSet}, + query::FilteredAccessSet, schedule::{Fallible, Infallible}, system::{input::SystemIn, System}, world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, World}, @@ -116,11 +116,6 @@ where self.observer.name() } - #[inline] - fn component_access(&self) -> &Access { - self.observer.component_access() - } - #[inline] fn component_access_set(&self) -> &FilteredAccessSet { self.observer.component_access_set() diff --git a/crates/bevy_ecs/src/system/schedule_system.rs b/crates/bevy_ecs/src/system/schedule_system.rs index 17bd3f46de8a7..5e05a5ada9c9f 100644 --- a/crates/bevy_ecs/src/system/schedule_system.rs +++ b/crates/bevy_ecs/src/system/schedule_system.rs @@ -3,7 +3,7 @@ use alloc::{borrow::Cow, vec::Vec}; use crate::{ component::{ComponentId, Tick}, error::Result, - query::{Access, FilteredAccessSet}, + query::FilteredAccessSet, system::{input::SystemIn, BoxedSystem, System, SystemInput}, world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, FromWorld, World}, }; @@ -33,11 +33,6 @@ impl> System for InfallibleSystemWrapper { self.0.type_id() } - #[inline] - fn component_access(&self) -> &Access { - self.0.component_access() - } - #[inline] fn component_access_set(&self) -> &FilteredAccessSet { self.0.component_access_set() @@ -154,10 +149,6 @@ where self.system.name() } - fn component_access(&self) -> &Access { - self.system.component_access() - } - fn component_access_set(&self) -> &FilteredAccessSet { self.system.component_access_set() } @@ -256,10 +247,6 @@ where self.system.name() } - fn component_access(&self) -> &Access { - self.system.component_access() - } - fn component_access_set(&self) -> &FilteredAccessSet { self.system.component_access_set() } diff --git a/crates/bevy_ecs/src/system/system.rs b/crates/bevy_ecs/src/system/system.rs index 211152f3d877c..fc96e8a843ace 100644 --- a/crates/bevy_ecs/src/system/system.rs +++ b/crates/bevy_ecs/src/system/system.rs @@ -9,7 +9,7 @@ use thiserror::Error; use crate::{ component::{ComponentId, Tick}, - query::{Access, FilteredAccessSet}, + query::FilteredAccessSet, schedule::InternedSystemSet, system::{input::SystemInput, SystemIn}, world::{unsafe_world_cell::UnsafeWorldCell, DeferredWorld, World}, @@ -57,9 +57,6 @@ pub trait System: Send + Sync + 'static { TypeId::of::() } - /// Returns the system's component [`Access`]. - fn component_access(&self) -> &Access; - /// Returns the system's component [`FilteredAccessSet`]. fn component_access_set(&self) -> &FilteredAccessSet; diff --git a/crates/bevy_ecs/src/world/unsafe_world_cell.rs b/crates/bevy_ecs/src/world/unsafe_world_cell.rs index 1959f3e5f3623..8fb084d444352 100644 --- a/crates/bevy_ecs/src/world/unsafe_world_cell.rs +++ b/crates/bevy_ecs/src/world/unsafe_world_cell.rs @@ -36,7 +36,7 @@ use thiserror::Error; /// /// This alone is not enough to implement bevy systems where multiple systems can access *disjoint* parts of the world concurrently. For this, bevy stores all values of /// resources and components (and [`ComponentTicks`]) in [`UnsafeCell`]s, and carefully validates disjoint access patterns using -/// APIs like [`System::component_access`](crate::system::System::component_access). +/// APIs like [`System::component_access_set`](crate::system::System::component_access_set). /// /// A system then can be executed using [`System::run_unsafe`](crate::system::System::run_unsafe) with a `&World` and use methods with interior mutability to access resource values. /// diff --git a/release-content/migration-guides/delete_component_access.md b/release-content/migration-guides/delete_component_access.md new file mode 100644 index 0000000000000..5369c506c5844 --- /dev/null +++ b/release-content/migration-guides/delete_component_access.md @@ -0,0 +1,10 @@ +--- +title: `System::component_access` has been deleted. +pull_requests: [19496] +--- + +`System::component_access` has been deleted. If you were calling this method, you can simply use +`my_system.component_access_set().combined_access()` to get the same result. + +If you were manually implementing this, it should be equivalent to `System::component_access_set` +anyway.