pub unsafe fn handle_wakeup_transition() {
        let mut this = AppState::get_mut();
        let event =
            match this.control_flow {
                ControlFlow::Poll => {
                    let event_handler = match &mut this.app_state {
                        &mut AppStateImpl::NotLaunched { .. }
                        | &mut AppStateImpl::Launching { .. } => return,
                        &mut AppStateImpl::PollFinished {
                            ref mut waiting_event_handler,
                        } => ptr::read(waiting_event_handler),
                        _ => bug!("`EventHandler` unexpectedly started polling"),
                    };
                    ptr::write(
                        &mut this.app_state,
                        AppStateImpl::ProcessingEvents {
                            event_handler,
                            active_control_flow: ControlFlow::Poll,
                        },
                    );
                    Event::NewEvents(StartCause::Poll)
                }
                ControlFlow::Wait => {
                    let (event_handler, start) = match &mut this.app_state {
                        &mut AppStateImpl::NotLaunched { .. }
                        | &mut AppStateImpl::Launching { .. } => return,
                        &mut AppStateImpl::Waiting {
                            ref mut waiting_event_handler,
                            ref mut start,
                        } => (ptr::read(waiting_event_handler), *start),
                        _ => bug!("`EventHandler` unexpectedly woke up"),
                    };
                    ptr::write(
                        &mut this.app_state,
                        AppStateImpl::ProcessingEvents {
                            event_handler,
                            active_control_flow: ControlFlow::Wait,
                        },
                    );
                    Event::NewEvents(StartCause::WaitCancelled {
                        start,
                        requested_resume: None,
                    })
                }
                ControlFlow::WaitUntil(requested_resume) => {
                    let (event_handler, start) = match &mut this.app_state {
                        &mut AppStateImpl::NotLaunched { .. }
                        | &mut AppStateImpl::Launching { .. } => return,
                        &mut AppStateImpl::Waiting {
                            ref mut waiting_event_handler,
                            ref mut start,
                        } => (ptr::read(waiting_event_handler), *start),
                        _ => bug!("`EventHandler` unexpectedly woke up"),
                    };
                    ptr::write(
                        &mut this.app_state,
                        AppStateImpl::ProcessingEvents {
                            event_handler,
                            active_control_flow: ControlFlow::WaitUntil(requested_resume),
                        },
                    );
                    if Instant::now() >= requested_resume {
                        Event::NewEvents(StartCause::ResumeTimeReached {
                            start,
                            requested_resume,
                        })
                    } else {
                        Event::NewEvents(StartCause::WaitCancelled {
                            start,
                            requested_resume: Some(requested_resume),
                        })
                    }
                }
                ControlFlow::Exit => bug!("unexpected controlflow `Exit`"),
            };
        drop(this);
        AppState::handle_nonuser_event(event)
    }
// requires main thread
// AppState::did_finish_launching handles the special transition `Init`
requires main thread
AppState::did_finish_launching handles the special transition `Init`
requires main thread AppState :: did_finish_launching handles the special transition ` Init `
pub unsafe fn handle_wakeup_transition() {
        let mut this = AppState::get_mut();
        let event =
            match this.control_flow {
                ControlFlow::Poll => {
                    let event_handler = match &mut this.app_state {
                        &mut AppStateImpl::NotLaunched { .. }
                        | &mut AppStateImpl::Launching { .. } => return,
                        &mut AppStateImpl::PollFinished {
                            ref mut waiting_event_handler,
                        } => ptr::read(waiting_event_handler),
                        _ => bug!("`EventHandler` unexpectedly started polling"),
                    };
                    ptr::write(
                        &mut this.app_state,
                        AppStateImpl::ProcessingEvents {
                            event_handler,
                            active_control_flow: ControlFlow::Poll,
                        },
                    );
                    Event::NewEvents(StartCause::Poll)
                }
                ControlFlow::Wait => {
                    let (event_handler, start) = match &mut this.app_state {
                        &mut AppStateImpl::NotLaunched { .. }
                        | &mut AppStateImpl::Launching { .. } => return,
                        &mut AppStateImpl::Waiting {
                            ref mut waiting_event_handler,
                            ref mut start,
                        } => (ptr::read(waiting_event_handler), *start),
                        _ => bug!("`EventHandler` unexpectedly woke up"),
                    };
                    ptr::write(
                        &mut this.app_state,
                        AppStateImpl::ProcessingEvents {
                            event_handler,
                            active_control_flow: ControlFlow::Wait,
                        },
                    );
                    Event::NewEvents(StartCause::WaitCancelled {
                        start,
                        requested_resume: None,
                    })
                }
                ControlFlow::WaitUntil(requested_resume) => {
                    let (event_handler, start) = match &mut this.app_state {
                        &mut AppStateImpl::NotLaunched { .. }
                        | &mut AppStateImpl::Launching { .. } => return,
                        &mut AppStateImpl::Waiting {
                            ref mut waiting_event_handler,
                            ref mut start,
                        } => (ptr::read(waiting_event_handler), *start),
                        _ => bug!("`EventHandler` unexpectedly woke up"),
                    };
                    ptr::write(
                        &mut this.app_state,
                        AppStateImpl::ProcessingEvents {
                            event_handler,
                            active_control_flow: ControlFlow::WaitUntil(requested_resume),
                        },
                    );
                    if Instant::now() >= requested_resume {
                        Event::NewEvents(StartCause::ResumeTimeReached {
                            start,
                            requested_resume,
                        })
                    } else {
                        Event::NewEvents(StartCause::WaitCancelled {
                            start,
                            requested_resume: Some(requested_resume),
                        })
                    }
                }
                ControlFlow::Exit => bug!("unexpected controlflow `Exit`"),
            };
        drop(this);
        AppState::handle_nonuser_event(event)
    }
pub unsafe fn handle_wakeup_transition ( ) { let mut this = AppState :: get_mut ( ) ; let event = match this . control_flow { ControlFlow :: Poll => { let event_handler = match & mut this . app_state { & mut AppStateImpl :: NotLaunched { .. } | & mut AppStateImpl :: Launching { .. } => return , & mut AppStateImpl :: PollFinished { ref mut waiting_event_handler , } => ptr :: read ( waiting_event_handler ) , _ => bug ! ( " " ) , } ; ptr :: write ( & mut this . app_state , AppStateImpl :: ProcessingEvents { event_handler , active_control_flow : ControlFlow :: Poll , } , ) ; Event :: NewEvents ( StartCause :: Poll ) } ControlFlow :: Wait => { let ( event_handler , start ) = match & mut this . app_state { & mut AppStateImpl :: NotLaunched { .. } | & mut AppStateImpl :: Launching { .. } => return , & mut AppStateImpl :: Waiting { ref mut waiting_event_handler , ref mut start , } => ( ptr :: read ( waiting_event_handler ) , * start ) , _ => bug ! ( " " ) , } ; ptr :: write ( & mut this . app_state , AppStateImpl :: ProcessingEvents { event_handler , active_control_flow : ControlFlow :: Wait , } , ) ; Event :: NewEvents ( StartCause :: WaitCancelled { start , requested_resume : None , } ) } ControlFlow :: WaitUntil ( requested_resume ) => { let ( event_handler , start ) = match & mut this . app_state { & mut AppStateImpl :: NotLaunched { .. } | & mut AppStateImpl :: Launching { .. } => return , & mut AppStateImpl :: Waiting { ref mut waiting_event_handler , ref mut start , } => ( ptr :: read ( waiting_event_handler ) , * start ) , _ => bug ! ( " " ) , } ; ptr :: write ( & mut this . app_state , AppStateImpl :: ProcessingEvents { event_handler , active_control_flow : ControlFlow :: WaitUntil ( requested_resume ) , } , ) ; if Instant :: now ( ) >= requested_resume { Event :: NewEvents ( StartCause :: ResumeTimeReached { start , requested_resume , } ) } else { Event :: NewEvents ( StartCause :: WaitCancelled { start , requested_resume : Some ( requested_resume ) , } ) } } ControlFlow :: Exit => bug ! ( " " ) , } ; drop ( this ) ; AppState :: handle_nonuser_event ( event ) }
requires main thread
AppState::did_finish_launching handles the special transition `Init`
requires main thread AppState :: did_finish_launching handles the special transition ` Init `