SystemSet::before and after: take AsSystemLabel (#4503)

# 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`
This commit is contained in:
SpecificProtagonist 2022-04-23 06:03:50 +00:00
parent 0fdb45ce90
commit 46acb7753c

View file

@ -1,9 +1,9 @@
use crate::schedule::{ use crate::schedule::{
AmbiguitySetLabel, BoxedAmbiguitySetLabel, BoxedSystemLabel, IntoRunCriteria, AmbiguitySetLabel, BoxedAmbiguitySetLabel, BoxedSystemLabel, IntoRunCriteria,
RunCriteriaDescriptorOrLabel, State, StateData, SystemDescriptor, SystemLabel, IntoSystemDescriptor, RunCriteriaDescriptorOrLabel, State, StateData, SystemDescriptor,
SystemLabel,
}; };
use crate::system::AsSystemLabel;
use super::IntoSystemDescriptor;
/// A builder for describing several systems at the same time. /// A builder for describing several systems at the same time.
#[derive(Default)] #[derive(Default)]
@ -95,14 +95,14 @@ impl SystemSet {
} }
#[must_use] #[must_use]
pub fn before(mut self, label: impl SystemLabel) -> Self { pub fn before<Marker>(mut self, label: impl AsSystemLabel<Marker>) -> Self {
self.before.push(Box::new(label)); self.before.push(Box::new(label.as_system_label()));
self self
} }
#[must_use] #[must_use]
pub fn after(mut self, label: impl SystemLabel) -> Self { pub fn after<Marker>(mut self, label: impl AsSystemLabel<Marker>) -> Self {
self.after.push(Box::new(label)); self.after.push(Box::new(label.as_system_label()));
self self
} }