From 86292bc68da63015ccdf8a84d6c7b6ec56579509 Mon Sep 17 00:00:00 2001 From: SpecificProtagonist Date: Sat, 23 Apr 2022 06:03:50 +0000 Subject: [PATCH] SystemSet::before and after: take AsSystemLabel (#4503) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Objective `AsSystemLabel` has been introduced on system descriptors to make ordering systems more convenient, but `SystemSet::before` and `SystemSet::after` still take `SystemLabels` directly: use bevy::ecs::system::AsSystemLabel; /*…*/ SystemSet::new().before(foo.as_system_label()) /*…*/ is currently necessary instead of /*…*/ SystemSet::new().before(foo) /*…*/ ## Solution Use `AsSystemLabel` for `SystemSet` --- crates/bevy_ecs/src/schedule/system_set.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/bevy_ecs/src/schedule/system_set.rs b/crates/bevy_ecs/src/schedule/system_set.rs index 5e32c2e48d1bb..4d9aa47cd844a 100644 --- a/crates/bevy_ecs/src/schedule/system_set.rs +++ b/crates/bevy_ecs/src/schedule/system_set.rs @@ -1,9 +1,9 @@ use crate::schedule::{ AmbiguitySetLabel, BoxedAmbiguitySetLabel, BoxedSystemLabel, IntoRunCriteria, - RunCriteriaDescriptorOrLabel, State, StateData, SystemDescriptor, SystemLabel, + IntoSystemDescriptor, RunCriteriaDescriptorOrLabel, State, StateData, SystemDescriptor, + SystemLabel, }; - -use super::IntoSystemDescriptor; +use crate::system::AsSystemLabel; /// A builder for describing several systems at the same time. #[derive(Default)] @@ -95,14 +95,14 @@ impl SystemSet { } #[must_use] - pub fn before(mut self, label: impl SystemLabel) -> Self { - self.before.push(Box::new(label)); + pub fn before(mut self, label: impl AsSystemLabel) -> Self { + self.before.push(Box::new(label.as_system_label())); self } #[must_use] - pub fn after(mut self, label: impl SystemLabel) -> Self { - self.after.push(Box::new(label)); + pub fn after(mut self, label: impl AsSystemLabel) -> Self { + self.after.push(Box::new(label.as_system_label())); self }