@@ -199,7 +199,7 @@ where
199199pub  mod  adapter { 
200200    use  crate :: system:: In ; 
201201    use  bevy_utils:: tracing; 
202-     use  std:: fmt:: Debug ; 
202+     use  std:: { fmt:: Debug ,  ops :: Not } ; 
203203
204204    /// Converts a regular function into a system adapter. 
205205/// 
@@ -406,6 +406,34 @@ pub mod adapter {
406406/// ``` 
407407pub  fn  ignore < T > ( In ( _) :  In < T > )  { } 
408408
409+     /// System adapter that inverts the output of the previous system in a pipe. 
410+ /// 
411+ /// # Examples 
412+ /// 
413+ /// ``` 
414+ /// use bevy_ecs::prelude::*; 
415+ /// // Building a new schedule/app... 
416+ /// let mut sched = Schedule::default(); 
417+ /// sched.add_system( 
418+ ///         // This system will always run. 
419+ ///         my_system.run_if(always_false.pipe(system_adapter::negate)) 
420+ ///     ) 
421+ ///     // ... 
422+ /// #   ; 
423+ /// # let mut world = World::new(); 
424+ /// # sched.run(&mut world); 
425+ /// 
426+ /// // A condition that always returns false. 
427+ /// fn always_false() -> bool { 
428+ ///    false 
429+ /// } 
430+ /// 
431+ /// # fn my_system() {} 
432+ /// ``` 
433+ pub  fn  negate < T :  Not > ( In ( val) :  In < T > )  -> T  { 
434+         !val
435+     } 
436+ 
409437    #[ cfg( test) ]  
410438    #[ test]  
411439    fn  assert_systems ( )  { 
@@ -423,16 +451,12 @@ pub mod adapter {
423451            unimplemented ! ( ) 
424452        } 
425453
426-         fn  not ( In ( val) :  In < bool > )  -> bool  { 
427-             !val
428-         } 
429- 
430454        assert_is_system ( returning :: < Result < u32 ,  std:: io:: Error > > . pipe ( unwrap) ) ; 
431455        assert_is_system ( returning :: < Option < ( ) > > . pipe ( ignore) ) ; 
432456        assert_is_system ( returning :: < & str > . pipe ( new ( u64:: from_str) ) . pipe ( unwrap) ) ; 
433457        assert_is_system ( exclusive_in_out :: < ( ) ,  Result < ( ) ,  std:: io:: Error > > . pipe ( error) ) ; 
434458        assert_is_system ( returning :: < bool > . pipe ( exclusive_in_out :: < bool ,  ( ) > ) ) ; 
435459
436-         returning :: < ( ) > . run_if ( returning :: < bool > . pipe ( not ) ) ; 
460+         returning :: < ( ) > . run_if ( returning :: < bool > . pipe ( negate ) ) ; 
437461    } 
438462} 
0 commit comments