@@ -17,7 +17,7 @@ use crate::{
1717 http:: { Request as HttpRequest , Response as HttpResponse } ,
1818 webview:: { WebviewAttributes , WindowBuilder } ,
1919 window:: { PendingWindow , WindowEvent } ,
20- Dispatch , ExitRequestedEventAction , RunEvent , Runtime ,
20+ Dispatch , ExitRequestedEventAction , RunEvent as RuntimeRunEvent , Runtime ,
2121 } ,
2222 scope:: FsScope ,
2323 sealed:: { ManagerBase , RuntimeOrDispatch } ,
@@ -80,7 +80,7 @@ impl CloseRequestApi {
8080/// An application event, triggered from the event loop.
8181#[ derive( Debug ) ]
8282#[ non_exhaustive]
83- pub enum Event {
83+ pub enum RunEvent {
8484 /// Event loop is exiting.
8585 Exit ,
8686 /// The app is about to exit
@@ -502,13 +502,18 @@ impl<R: Runtime> App<R> {
502502 /// });
503503 /// }
504504 /// ```
505- pub fn run < F : FnMut ( & AppHandle < R > , Event ) + ' static > ( mut self , mut callback : F ) {
505+ pub fn run < F : FnMut ( & AppHandle < R > , RunEvent ) + ' static > ( mut self , mut callback : F ) {
506506 let app_handle = self . handle ( ) ;
507507 let manager = self . manager . clone ( ) ;
508508 self . runtime . take ( ) . unwrap ( ) . run ( move |event| match event {
509- RunEvent :: Exit => {
509+ RuntimeRunEvent :: Exit => {
510510 app_handle. cleanup_before_exit ( ) ;
511- on_event_loop_event ( & app_handle, RunEvent :: Exit , & manager, Some ( & mut callback) ) ;
511+ on_event_loop_event (
512+ & app_handle,
513+ RuntimeRunEvent :: Exit ,
514+ & manager,
515+ Some ( & mut callback) ,
516+ ) ;
512517 }
513518 _ => {
514519 on_event_loop_event ( & app_handle, event, & manager, Some ( & mut callback) ) ;
@@ -545,7 +550,7 @@ impl<R: Runtime> App<R> {
545550 & app_handle,
546551 event,
547552 & manager,
548- Option :: < & mut Box < dyn FnMut ( & AppHandle < R > , Event ) > > :: None ,
553+ Option :: < & mut Box < dyn FnMut ( & AppHandle < R > , RunEvent ) > > :: None ,
549554 )
550555 } )
551556 }
@@ -1187,30 +1192,30 @@ impl<R: Runtime> Builder<R> {
11871192 }
11881193}
11891194
1190- fn on_event_loop_event < R : Runtime , F : FnMut ( & AppHandle < R > , Event ) + ' static > (
1195+ fn on_event_loop_event < R : Runtime , F : FnMut ( & AppHandle < R > , RunEvent ) + ' static > (
11911196 app_handle : & AppHandle < R > ,
1192- event : RunEvent ,
1197+ event : RuntimeRunEvent ,
11931198 manager : & WindowManager < R > ,
11941199 callback : Option < & mut F > ,
11951200) {
1196- if let RunEvent :: WindowClose ( label) = & event {
1201+ if let RuntimeRunEvent :: WindowClose ( label) = & event {
11971202 manager. on_window_close ( label) ;
11981203 }
11991204
12001205 let event = match event {
1201- RunEvent :: Exit => Event :: Exit ,
1202- RunEvent :: ExitRequested { window_label, tx } => Event :: ExitRequested {
1206+ RuntimeRunEvent :: Exit => RunEvent :: Exit ,
1207+ RuntimeRunEvent :: ExitRequested { window_label, tx } => RunEvent :: ExitRequested {
12031208 window_label,
12041209 api : ExitRequestApi ( tx) ,
12051210 } ,
1206- RunEvent :: CloseRequested { label, signal_tx } => Event :: CloseRequested {
1211+ RuntimeRunEvent :: CloseRequested { label, signal_tx } => RunEvent :: CloseRequested {
12071212 label,
12081213 api : CloseRequestApi ( signal_tx) ,
12091214 } ,
1210- RunEvent :: WindowClose ( label) => Event :: WindowClosed ( label) ,
1211- RunEvent :: Ready => Event :: Ready ,
1212- RunEvent :: Resumed => Event :: Resumed ,
1213- RunEvent :: MainEventsCleared => Event :: MainEventsCleared ,
1215+ RuntimeRunEvent :: WindowClose ( label) => RunEvent :: WindowClosed ( label) ,
1216+ RuntimeRunEvent :: Ready => RunEvent :: Ready ,
1217+ RuntimeRunEvent :: Resumed => RunEvent :: Resumed ,
1218+ RuntimeRunEvent :: MainEventsCleared => RunEvent :: MainEventsCleared ,
12141219 _ => unimplemented ! ( ) ,
12151220 } ;
12161221
0 commit comments