From d3de7416f7432dcb1021672c353ea4b63e152055 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 10 Jul 2021 01:03:55 +1000 Subject: [PATCH] Implement std::ops::Not for ShouldRun --- crates/bevy_ecs/src/schedule/run_criteria.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/bevy_ecs/src/schedule/run_criteria.rs b/crates/bevy_ecs/src/schedule/run_criteria.rs index f9f7edf3b2ef8..8230f767fd70d 100644 --- a/crates/bevy_ecs/src/schedule/run_criteria.rs +++ b/crates/bevy_ecs/src/schedule/run_criteria.rs @@ -44,6 +44,19 @@ pub enum ShouldRun { NoAndCheckAgain, } +impl std::ops::Not for ShouldRun { + type Output = Self; + + fn not(self) -> Self { + match self { + ShouldRun::Yes => ShouldRun::No, + ShouldRun::No => ShouldRun::Yes, + ShouldRun::YesAndCheckAgain => ShouldRun::NoAndCheckAgain, + ShouldRun::NoAndCheckAgain => ShouldRun::YesAndCheckAgain, + } + } +} + pub(crate) struct BoxedRunCriteria { criteria_system: Option>, initialized: bool,