mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
Reorder impl to be the same as the trait (#10964)
# Objective - Make the implementation order consistent between all sources to fit the order in the trait. ## Solution - Change the implementation order.
This commit is contained in:
parent
c0489c362c
commit
b2661ea73d
12 changed files with 158 additions and 158 deletions
|
@ -616,8 +616,12 @@ impl<'a, E: Event> Iterator for EventIterator<'a, E> {
|
|||
self.iter.next().map(|(event, _)| event)
|
||||
}
|
||||
|
||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||
self.iter.nth(n).map(|(event, _)| event)
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.iter.size_hint()
|
||||
}
|
||||
|
||||
fn count(self) -> usize {
|
||||
self.iter.count()
|
||||
}
|
||||
|
||||
fn last(self) -> Option<Self::Item>
|
||||
|
@ -627,12 +631,8 @@ impl<'a, E: Event> Iterator for EventIterator<'a, E> {
|
|||
self.iter.last().map(|(event, _)| event)
|
||||
}
|
||||
|
||||
fn count(self) -> usize {
|
||||
self.iter.count()
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.iter.size_hint()
|
||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||
self.iter.nth(n).map(|(event, _)| event)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,16 +696,13 @@ impl<'a, E: Event> Iterator for EventIteratorWithId<'a, E> {
|
|||
}
|
||||
}
|
||||
|
||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||
if let Some(EventInstance { event_id, event }) = self.chain.nth(n) {
|
||||
self.reader.last_event_count += n + 1;
|
||||
self.unread -= n + 1;
|
||||
Some((event, *event_id))
|
||||
} else {
|
||||
self.reader.last_event_count += self.unread;
|
||||
self.unread = 0;
|
||||
None
|
||||
}
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.chain.size_hint()
|
||||
}
|
||||
|
||||
fn count(self) -> usize {
|
||||
self.reader.last_event_count += self.unread;
|
||||
self.unread
|
||||
}
|
||||
|
||||
fn last(self) -> Option<Self::Item>
|
||||
|
@ -717,13 +714,16 @@ impl<'a, E: Event> Iterator for EventIteratorWithId<'a, E> {
|
|||
Some((event, *event_id))
|
||||
}
|
||||
|
||||
fn count(self) -> usize {
|
||||
self.reader.last_event_count += self.unread;
|
||||
self.unread
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.chain.size_hint()
|
||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||
if let Some(EventInstance { event_id, event }) = self.chain.nth(n) {
|
||||
self.reader.last_event_count += n + 1;
|
||||
self.unread -= n + 1;
|
||||
Some((event, *event_id))
|
||||
} else {
|
||||
self.reader.last_event_count += self.unread;
|
||||
self.unread = 0;
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -278,16 +278,14 @@ pub type ROQueryItem<'w, D> = QueryItem<'w, <D as QueryData>::ReadOnly>;
|
|||
/// `update_component_access` and `update_archetype_component_access` do nothing.
|
||||
/// This is sound because `fetch` does not access components.
|
||||
unsafe impl WorldQuery for Entity {
|
||||
type Fetch<'w> = ();
|
||||
type Item<'w> = Entity;
|
||||
type Fetch<'w> = ();
|
||||
type State = ();
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Self::Item<'wlong>) -> Self::Item<'wshort> {
|
||||
item
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = true;
|
||||
|
||||
unsafe fn init_fetch<'w>(
|
||||
_world: UnsafeWorldCell<'w>,
|
||||
_state: &Self::State,
|
||||
|
@ -296,6 +294,8 @@ unsafe impl WorldQuery for Entity {
|
|||
) -> Self::Fetch<'w> {
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = true;
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
_fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -350,16 +350,14 @@ unsafe impl ReadOnlyQueryData for Entity {}
|
|||
/// This is sound because `update_component_access` and `update_archetype_component_access` set read access for all components and panic when appropriate.
|
||||
/// Filters are unchanged.
|
||||
unsafe impl<'a> WorldQuery for EntityRef<'a> {
|
||||
type Fetch<'w> = UnsafeWorldCell<'w>;
|
||||
type Item<'w> = EntityRef<'w>;
|
||||
type Fetch<'w> = UnsafeWorldCell<'w>;
|
||||
type State = ();
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Self::Item<'wlong>) -> Self::Item<'wshort> {
|
||||
item
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = true;
|
||||
|
||||
unsafe fn init_fetch<'w>(
|
||||
world: UnsafeWorldCell<'w>,
|
||||
_state: &Self::State,
|
||||
|
@ -369,6 +367,8 @@ unsafe impl<'a> WorldQuery for EntityRef<'a> {
|
|||
world
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = true;
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
_fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -432,16 +432,14 @@ unsafe impl ReadOnlyQueryData for EntityRef<'_> {}
|
|||
|
||||
/// SAFETY: The accesses of `Self::ReadOnly` are a subset of the accesses of `Self`
|
||||
unsafe impl<'a> WorldQuery for EntityMut<'a> {
|
||||
type Fetch<'w> = UnsafeWorldCell<'w>;
|
||||
type Item<'w> = EntityMut<'w>;
|
||||
type Fetch<'w> = UnsafeWorldCell<'w>;
|
||||
type State = ();
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Self::Item<'wlong>) -> Self::Item<'wshort> {
|
||||
item
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = true;
|
||||
|
||||
unsafe fn init_fetch<'w>(
|
||||
world: UnsafeWorldCell<'w>,
|
||||
_state: &Self::State,
|
||||
|
@ -451,6 +449,8 @@ unsafe impl<'a> WorldQuery for EntityMut<'a> {
|
|||
world
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = true;
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
_fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -530,21 +530,14 @@ impl<T> Copy for ReadFetch<'_, T> {}
|
|||
/// `update_component_access` adds a `With` filter for a component.
|
||||
/// This is sound because `matches_component_set` returns whether the set contains that component.
|
||||
unsafe impl<T: Component> WorldQuery for &T {
|
||||
type Fetch<'w> = ReadFetch<'w, T>;
|
||||
type Item<'w> = &'w T;
|
||||
type Fetch<'w> = ReadFetch<'w, T>;
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: &'wlong T) -> &'wshort T {
|
||||
item
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn init_fetch<'w>(
|
||||
world: UnsafeWorldCell<'w>,
|
||||
|
@ -568,6 +561,13 @@ unsafe impl<T: Component> WorldQuery for &T {
|
|||
}
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
fetch: &mut ReadFetch<'w, T>,
|
||||
|
@ -686,21 +686,14 @@ impl<T> Copy for RefFetch<'_, T> {}
|
|||
/// `update_component_access` adds a `With` filter for a component.
|
||||
/// This is sound because `matches_component_set` returns whether the set contains that component.
|
||||
unsafe impl<'__w, T: Component> WorldQuery for Ref<'__w, T> {
|
||||
type Fetch<'w> = RefFetch<'w, T>;
|
||||
type Item<'w> = Ref<'w, T>;
|
||||
type Fetch<'w> = RefFetch<'w, T>;
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Ref<'wlong, T>) -> Ref<'wshort, T> {
|
||||
item
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn init_fetch<'w>(
|
||||
world: UnsafeWorldCell<'w>,
|
||||
|
@ -723,6 +716,13 @@ unsafe impl<'__w, T: Component> WorldQuery for Ref<'__w, T> {
|
|||
}
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
fetch: &mut RefFetch<'w, T>,
|
||||
|
@ -853,21 +853,14 @@ impl<T> Copy for WriteFetch<'_, T> {}
|
|||
/// `update_component_access` adds a `With` filter for a component.
|
||||
/// This is sound because `matches_component_set` returns whether the set contains that component.
|
||||
unsafe impl<'__w, T: Component> WorldQuery for &'__w mut T {
|
||||
type Fetch<'w> = WriteFetch<'w, T>;
|
||||
type Item<'w> = Mut<'w, T>;
|
||||
type Fetch<'w> = WriteFetch<'w, T>;
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Mut<'wlong, T>) -> Mut<'wshort, T> {
|
||||
item
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn init_fetch<'w>(
|
||||
world: UnsafeWorldCell<'w>,
|
||||
|
@ -890,6 +883,13 @@ unsafe impl<'__w, T: Component> WorldQuery for &'__w mut T {
|
|||
}
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
fetch: &mut WriteFetch<'w, T>,
|
||||
|
@ -1009,16 +1009,14 @@ impl<T: WorldQuery> Clone for OptionFetch<'_, T> {
|
|||
/// This is sound because `update_component_access` and `update_archetype_component_access` add the same accesses as `T`.
|
||||
/// Filters are unchanged.
|
||||
unsafe impl<T: WorldQuery> WorldQuery for Option<T> {
|
||||
type Fetch<'w> = OptionFetch<'w, T>;
|
||||
type Item<'w> = Option<T::Item<'w>>;
|
||||
type Fetch<'w> = OptionFetch<'w, T>;
|
||||
type State = T::State;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Self::Item<'wlong>) -> Self::Item<'wshort> {
|
||||
item.map(T::shrink)
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = T::IS_DENSE;
|
||||
|
||||
#[inline]
|
||||
unsafe fn init_fetch<'w>(
|
||||
world: UnsafeWorldCell<'w>,
|
||||
|
@ -1032,6 +1030,8 @@ unsafe impl<T: WorldQuery> WorldQuery for Option<T> {
|
|||
}
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = T::IS_DENSE;
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
fetch: &mut OptionFetch<'w, T>,
|
||||
|
@ -1168,21 +1168,14 @@ pub struct Has<T>(PhantomData<T>);
|
|||
/// `update_component_access` and `update_archetype_component_access` do nothing.
|
||||
/// This is sound because `fetch` does not access components.
|
||||
unsafe impl<T: Component> WorldQuery for Has<T> {
|
||||
type Fetch<'w> = bool;
|
||||
type Item<'w> = bool;
|
||||
type Fetch<'w> = bool;
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Self::Item<'wlong>) -> Self::Item<'wshort> {
|
||||
item
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn init_fetch<'w>(
|
||||
_world: UnsafeWorldCell<'w>,
|
||||
|
@ -1193,6 +1186,13 @@ unsafe impl<T: Component> WorldQuery for Has<T> {
|
|||
false
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = {
|
||||
match T::Storage::STORAGE_TYPE {
|
||||
StorageType::Table => true,
|
||||
StorageType::SparseSet => false,
|
||||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -1408,14 +1408,12 @@ pub struct NopWorldQuery<D: QueryData>(PhantomData<D>);
|
|||
/// `update_component_access` and `update_archetype_component_access` do nothing.
|
||||
/// This is sound because `fetch` does not access components.
|
||||
unsafe impl<D: QueryData> WorldQuery for NopWorldQuery<D> {
|
||||
type Fetch<'w> = ();
|
||||
type Item<'w> = ();
|
||||
type Fetch<'w> = ();
|
||||
type State = D::State;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(_: ()) {}
|
||||
|
||||
const IS_DENSE: bool = D::IS_DENSE;
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn init_fetch(
|
||||
_world: UnsafeWorldCell,
|
||||
|
@ -1425,6 +1423,8 @@ unsafe impl<D: QueryData> WorldQuery for NopWorldQuery<D> {
|
|||
) {
|
||||
}
|
||||
|
||||
const IS_DENSE: bool = D::IS_DENSE;
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn set_archetype(
|
||||
_fetch: &mut (),
|
||||
|
|
|
@ -128,8 +128,8 @@ pub struct With<T>(PhantomData<T>);
|
|||
/// `update_component_access` adds a `With` filter for `T`.
|
||||
/// This is sound because `matches_component_set` returns whether the set contains the component.
|
||||
unsafe impl<T: Component> WorldQuery for With<T> {
|
||||
type Fetch<'w> = ();
|
||||
type Item<'w> = ();
|
||||
type Fetch<'w> = ();
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(_: Self::Item<'wlong>) -> Self::Item<'wshort> {}
|
||||
|
@ -150,9 +150,6 @@ unsafe impl<T: Component> WorldQuery for With<T> {
|
|||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table(_fetch: &mut (), _state: &ComponentId, _table: &Table) {}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype(
|
||||
_fetch: &mut (),
|
||||
|
@ -162,6 +159,9 @@ unsafe impl<T: Component> WorldQuery for With<T> {
|
|||
) {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table(_fetch: &mut (), _state: &ComponentId, _table: &Table) {}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn fetch<'w>(
|
||||
_fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -240,8 +240,8 @@ pub struct Without<T>(PhantomData<T>);
|
|||
/// `update_component_access` adds a `Without` filter for `T`.
|
||||
/// This is sound because `matches_component_set` returns whether the set does not contain the component.
|
||||
unsafe impl<T: Component> WorldQuery for Without<T> {
|
||||
type Fetch<'w> = ();
|
||||
type Item<'w> = ();
|
||||
type Fetch<'w> = ();
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(_: Self::Item<'wlong>) -> Self::Item<'wshort> {}
|
||||
|
@ -262,9 +262,6 @@ unsafe impl<T: Component> WorldQuery for Without<T> {
|
|||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table(_fetch: &mut (), _state: &Self::State, _table: &Table) {}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype(
|
||||
_fetch: &mut (),
|
||||
|
@ -274,6 +271,9 @@ unsafe impl<T: Component> WorldQuery for Without<T> {
|
|||
) {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table(_fetch: &mut (), _state: &Self::State, _table: &Table) {}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn fetch<'w>(
|
||||
_fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -561,8 +561,8 @@ pub struct AddedFetch<'w> {
|
|||
/// `update_component_access` adds a `With` filter for a component.
|
||||
/// This is sound because `matches_component_set` returns whether the set contains that component.
|
||||
unsafe impl<T: Component> WorldQuery for Added<T> {
|
||||
type Fetch<'w> = AddedFetch<'w>;
|
||||
type Item<'w> = bool;
|
||||
type Fetch<'w> = AddedFetch<'w>;
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Self::Item<'wlong>) -> Self::Item<'wshort> {
|
||||
|
@ -592,18 +592,6 @@ unsafe impl<T: Component> WorldQuery for Added<T> {
|
|||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
&component_id: &ComponentId,
|
||||
table: &'w Table,
|
||||
) {
|
||||
fetch.table_ticks = Some(
|
||||
Column::get_added_ticks_slice(table.get_column(component_id).debug_checked_unwrap())
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -616,6 +604,18 @@ unsafe impl<T: Component> WorldQuery for Added<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
&component_id: &ComponentId,
|
||||
table: &'w Table,
|
||||
) {
|
||||
fetch.table_ticks = Some(
|
||||
Column::get_added_ticks_slice(table.get_column(component_id).debug_checked_unwrap())
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn fetch<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -737,8 +737,8 @@ pub struct ChangedFetch<'w> {
|
|||
/// `update_component_access` adds a `With` filter for a component.
|
||||
/// This is sound because `matches_component_set` returns whether the set contains that component.
|
||||
unsafe impl<T: Component> WorldQuery for Changed<T> {
|
||||
type Fetch<'w> = ChangedFetch<'w>;
|
||||
type Item<'w> = bool;
|
||||
type Fetch<'w> = ChangedFetch<'w>;
|
||||
type State = ComponentId;
|
||||
|
||||
fn shrink<'wlong: 'wshort, 'wshort>(item: Self::Item<'wlong>) -> Self::Item<'wshort> {
|
||||
|
@ -768,18 +768,6 @@ unsafe impl<T: Component> WorldQuery for Changed<T> {
|
|||
}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
&component_id: &ComponentId,
|
||||
table: &'w Table,
|
||||
) {
|
||||
fetch.table_ticks = Some(
|
||||
Column::get_changed_ticks_slice(table.get_column(component_id).debug_checked_unwrap())
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_archetype<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
|
@ -792,6 +780,18 @@ unsafe impl<T: Component> WorldQuery for Changed<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn set_table<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
&component_id: &ComponentId,
|
||||
table: &'w Table,
|
||||
) {
|
||||
fetch.table_ticks = Some(
|
||||
Column::get_changed_ticks_slice(table.get_column(component_id).debug_checked_unwrap())
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn fetch<'w>(
|
||||
fetch: &mut Self::Fetch<'w>,
|
||||
|
|
|
@ -390,6 +390,11 @@ impl IntoSystemConfigs<()> for SystemConfigs {
|
|||
self
|
||||
}
|
||||
|
||||
fn run_if<M>(mut self, condition: impl Condition<M>) -> SystemConfigs {
|
||||
self.run_if_dyn(new_condition(condition));
|
||||
self
|
||||
}
|
||||
|
||||
fn ambiguous_with<M>(mut self, set: impl IntoSystemSet<M>) -> Self {
|
||||
let set = set.into_system_set();
|
||||
self.ambiguous_with_inner(set.intern());
|
||||
|
@ -401,11 +406,6 @@ impl IntoSystemConfigs<()> for SystemConfigs {
|
|||
self
|
||||
}
|
||||
|
||||
fn run_if<M>(mut self, condition: impl Condition<M>) -> SystemConfigs {
|
||||
self.run_if_dyn(new_condition(condition));
|
||||
self
|
||||
}
|
||||
|
||||
fn chain(self) -> Self {
|
||||
self.chain_inner()
|
||||
}
|
||||
|
|
|
@ -128,10 +128,6 @@ impl SystemExecutor for MultiThreadedExecutor {
|
|||
ExecutorKind::MultiThreaded
|
||||
}
|
||||
|
||||
fn set_apply_final_deferred(&mut self, value: bool) {
|
||||
self.apply_final_deferred = value;
|
||||
}
|
||||
|
||||
fn init(&mut self, schedule: &SystemSchedule) {
|
||||
// pre-allocate space
|
||||
let sys_count = schedule.system_ids.len();
|
||||
|
@ -261,6 +257,10 @@ impl SystemExecutor for MultiThreadedExecutor {
|
|||
self.skipped_systems.clear();
|
||||
self.completed_systems.clear();
|
||||
}
|
||||
|
||||
fn set_apply_final_deferred(&mut self, value: bool) {
|
||||
self.apply_final_deferred = value;
|
||||
}
|
||||
}
|
||||
|
||||
impl MultiThreadedExecutor {
|
||||
|
|
|
@ -23,10 +23,6 @@ impl SystemExecutor for SimpleExecutor {
|
|||
ExecutorKind::Simple
|
||||
}
|
||||
|
||||
fn set_apply_final_deferred(&mut self, _: bool) {
|
||||
// do nothing. simple executor does not do a final sync
|
||||
}
|
||||
|
||||
fn init(&mut self, schedule: &SystemSchedule) {
|
||||
let sys_count = schedule.system_ids.len();
|
||||
let set_count = schedule.set_ids.len();
|
||||
|
@ -91,6 +87,10 @@ impl SystemExecutor for SimpleExecutor {
|
|||
self.evaluated_sets.clear();
|
||||
self.completed_systems.clear();
|
||||
}
|
||||
|
||||
fn set_apply_final_deferred(&mut self, _: bool) {
|
||||
// do nothing. simple executor does not do a final sync
|
||||
}
|
||||
}
|
||||
|
||||
impl SimpleExecutor {
|
||||
|
|
|
@ -29,10 +29,6 @@ impl SystemExecutor for SingleThreadedExecutor {
|
|||
ExecutorKind::SingleThreaded
|
||||
}
|
||||
|
||||
fn set_apply_final_deferred(&mut self, apply_final_deferred: bool) {
|
||||
self.apply_final_deferred = apply_final_deferred;
|
||||
}
|
||||
|
||||
fn init(&mut self, schedule: &SystemSchedule) {
|
||||
// pre-allocate space
|
||||
let sys_count = schedule.system_ids.len();
|
||||
|
@ -105,6 +101,10 @@ impl SystemExecutor for SingleThreadedExecutor {
|
|||
self.evaluated_sets.clear();
|
||||
self.completed_systems.clear();
|
||||
}
|
||||
|
||||
fn set_apply_final_deferred(&mut self, apply_final_deferred: bool) {
|
||||
self.apply_final_deferred = apply_final_deferred;
|
||||
}
|
||||
}
|
||||
|
||||
impl SingleThreadedExecutor {
|
||||
|
|
|
@ -131,6 +131,10 @@ impl SystemSet for AnonymousSet {
|
|||
true
|
||||
}
|
||||
|
||||
fn dyn_clone(&self) -> Box<dyn SystemSet> {
|
||||
Box::new(*self)
|
||||
}
|
||||
|
||||
fn as_dyn_eq(&self) -> &dyn DynEq {
|
||||
self
|
||||
}
|
||||
|
@ -139,10 +143,6 @@ impl SystemSet for AnonymousSet {
|
|||
TypeId::of::<Self>().hash(&mut state);
|
||||
self.hash(&mut state);
|
||||
}
|
||||
|
||||
fn dyn_clone(&self) -> Box<dyn SystemSet> {
|
||||
Box::new(*self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Types that can be converted into a [`SystemSet`].
|
||||
|
|
|
@ -135,6 +135,10 @@ where
|
|||
self.system.check_change_tick(change_tick);
|
||||
}
|
||||
|
||||
fn default_system_sets(&self) -> Vec<InternedSystemSet> {
|
||||
self.system.default_system_sets()
|
||||
}
|
||||
|
||||
fn get_last_run(&self) -> crate::component::Tick {
|
||||
self.system.get_last_run()
|
||||
}
|
||||
|
@ -142,10 +146,6 @@ where
|
|||
fn set_last_run(&mut self, last_run: crate::component::Tick) {
|
||||
self.system.set_last_run(last_run);
|
||||
}
|
||||
|
||||
fn default_system_sets(&self) -> Vec<InternedSystemSet> {
|
||||
self.system.default_system_sets()
|
||||
}
|
||||
}
|
||||
|
||||
// SAFETY: The inner system is read-only.
|
||||
|
|
|
@ -218,6 +218,12 @@ where
|
|||
self.b.check_change_tick(change_tick);
|
||||
}
|
||||
|
||||
fn default_system_sets(&self) -> Vec<InternedSystemSet> {
|
||||
let mut default_sets = self.a.default_system_sets();
|
||||
default_sets.append(&mut self.b.default_system_sets());
|
||||
default_sets
|
||||
}
|
||||
|
||||
fn get_last_run(&self) -> Tick {
|
||||
self.a.get_last_run()
|
||||
}
|
||||
|
@ -226,12 +232,6 @@ where
|
|||
self.a.set_last_run(last_run);
|
||||
self.b.set_last_run(last_run);
|
||||
}
|
||||
|
||||
fn default_system_sets(&self) -> Vec<InternedSystemSet> {
|
||||
let mut default_sets = self.a.default_system_sets();
|
||||
default_sets.append(&mut self.b.default_system_sets());
|
||||
default_sets
|
||||
}
|
||||
}
|
||||
|
||||
/// SAFETY: Both systems are read-only, so any system created by combining them will only read from the world.
|
||||
|
|
|
@ -88,6 +88,11 @@ where
|
|||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_exclusive(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn run_unsafe(&mut self, _input: Self::In, _world: UnsafeWorldCell) -> Self::Out {
|
||||
panic!("Cannot run exclusive systems with a shared World reference");
|
||||
|
@ -114,19 +119,6 @@ where
|
|||
out
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_exclusive(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn get_last_run(&self) -> Tick {
|
||||
self.system_meta.last_run
|
||||
}
|
||||
|
||||
fn set_last_run(&mut self, last_run: Tick) {
|
||||
self.system_meta.last_run = last_run;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn apply_deferred(&mut self, _world: &mut World) {
|
||||
// "pure" exclusive systems do not have any buffers to apply.
|
||||
|
@ -155,6 +147,14 @@ where
|
|||
let set = crate::schedule::SystemTypeSet::<F>::new();
|
||||
vec![set.intern()]
|
||||
}
|
||||
|
||||
fn get_last_run(&self) -> Tick {
|
||||
self.system_meta.last_run
|
||||
}
|
||||
|
||||
fn set_last_run(&mut self, last_run: Tick) {
|
||||
self.system_meta.last_run = last_run;
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait implemented for all exclusive system functions that can be used as [`System`]s.
|
||||
|
|
|
@ -487,14 +487,6 @@ where
|
|||
out
|
||||
}
|
||||
|
||||
fn get_last_run(&self) -> Tick {
|
||||
self.system_meta.last_run
|
||||
}
|
||||
|
||||
fn set_last_run(&mut self, last_run: Tick) {
|
||||
self.system_meta.last_run = last_run;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn apply_deferred(&mut self, world: &mut World) {
|
||||
let param_state = self.param_state.as_mut().expect(Self::PARAM_MESSAGE);
|
||||
|
@ -533,6 +525,14 @@ where
|
|||
let set = crate::schedule::SystemTypeSet::<F>::new();
|
||||
vec![set.intern()]
|
||||
}
|
||||
|
||||
fn get_last_run(&self) -> Tick {
|
||||
self.system_meta.last_run
|
||||
}
|
||||
|
||||
fn set_last_run(&mut self, last_run: Tick) {
|
||||
self.system_meta.last_run = last_run;
|
||||
}
|
||||
}
|
||||
|
||||
/// SAFETY: `F`'s param is [`ReadOnlySystemParam`], so this system will only read from the world.
|
||||
|
|
Loading…
Reference in a new issue