@@ -9,11 +9,7 @@ use std::time::Duration;
99
1010fn main ( ) {
1111 App :: new ( )
12- . add_plugins ( (
13- MinimalPlugins ,
14- LogPlugin :: default ( ) ,
15- FlurxPlugin ,
16- ) )
12+ . add_plugins ( ( MinimalPlugins , LogPlugin :: default ( ) , FlurxPlugin ) )
1713 . add_systems ( Startup , spawn_reactor)
1814 . run ( ) ;
1915}
@@ -27,7 +23,8 @@ fn spawn_reactor(mut commands: Commands) {
2723 message : "After 3 seconds, this message is displayed." ,
2824 } ) )
2925 . then ( once:: event:: app_exit_success ( ) )
30- } ) . await ;
26+ } )
27+ . await ;
3128 } ) ) ;
3229}
3330
@@ -46,8 +43,12 @@ struct DelayedLogRunner {
4643}
4744
4845impl Runner for DelayedLogRunner {
49- fn run ( & mut self , world : & mut World , cancellation_handlers : & mut CancellationHandlers ) -> RunnerIs {
50- let cancellation_id = self . cancellation_id . get_or_insert_with ( ||{
46+ fn run (
47+ & mut self ,
48+ world : & mut World ,
49+ cancellation_handlers : & mut CancellationHandlers ,
50+ ) -> RunnerIs {
51+ let cancellation_id = self . cancellation_id . get_or_insert_with ( || {
5152 // You can register a handler that will be invoked when the reactor is canceled.
5253 cancellation_handlers. register ( |_world : & mut World | {
5354 info ! ( "CancellationLogRunner is canceled." ) ;
@@ -62,13 +63,13 @@ impl Runner for DelayedLogRunner {
6263 cancellation_handlers. unregister ( cancellation_id) ;
6364 RunnerIs :: Completed
6465 }
65- other => other
66+ other => other,
6667 }
6768 }
6869}
6970
7071/// Finally, we create a function that returns an action.
71- ///
72+ ///
7273/// It is recommended that the action's input is passed by the [`ActionSeed::with`] instead of the argument of this function.
7374/// By doing so, you can pass the input value with [`Pipe::pipe`].
7475fn delayed_log ( ) -> ActionSeed < DelayedLogInput , & ' static str > {
@@ -82,4 +83,4 @@ fn delayed_log() -> ActionSeed<DelayedLogInput, &'static str> {
8283 cancellation_id : None ,
8384 }
8485 } )
85- }
86+ }
0 commit comments