Skip to content

Commit

Permalink
SystemSet::before and after: take AsSystemLabel (#4503)
Browse files Browse the repository at this point in the history
# 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`
  • Loading branch information
SpecificProtagonist committed Apr 23, 2022
1 parent 0fdb45c commit 46acb77
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/bevy_ecs/src/schedule/system_set.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -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<Marker>(mut self, label: impl AsSystemLabel<Marker>) -> 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<Marker>(mut self, label: impl AsSystemLabel<Marker>) -> Self {
self.after.push(Box::new(label.as_system_label()));
self
}

Expand Down

0 comments on commit 46acb77

Please sign in to comment.