fn with_delegate<R, F>(&mut self, f: F) -> Option<R>
    where
        F: FnOnce(&mut dyn AppDelegate<T>, &mut T, &Env, &mut DelegateCtx) -> R,
    {
        let InnerAppState {
            ref mut delegate,
            ref mut command_queue,
            ref mut data,
            ref ext_event_host,
            ref env,
            ..
        } = self;
        let mut ctx = DelegateCtx {
            command_queue,
            app_data_type: TypeId::of::<T>(),
            ext_event_host,
        };
        delegate
            .as_deref_mut()
            .map(|delegate| f(delegate, data, env, &mut ctx))
    }
/// A helper fn for setting up the `DelegateCtx`. Takes a closure with
/// an arbitrary return type `R`, and returns `Some(R)` if an `AppDelegate`
/// is configured.
A helper fn for setting up the `DelegateCtx`.
A helper fn for setting up the ` DelegateCtx ` .
fn with_delegate<R, F>(&mut self, f: F) -> Option<R>
    where
        F: FnOnce(&mut dyn AppDelegate<T>, &mut T, &Env, &mut DelegateCtx) -> R,
    {
        let InnerAppState {
            ref mut delegate,
            ref mut command_queue,
            ref mut data,
            ref ext_event_host,
            ref env,
            ..
        } = self;
        let mut ctx = DelegateCtx {
            command_queue,
            app_data_type: TypeId::of::<T>(),
            ext_event_host,
        };
        delegate
            .as_deref_mut()
            .map(|delegate| f(delegate, data, env, &mut ctx))
    }
fn with_delegate < R , F > ( & mut self , f : F ) -> Option < R > where F : FnOnce ( & mut dyn AppDelegate < T > , & mut T , & Env , & mut DelegateCtx ) -> R , { let InnerAppState { ref mut delegate , ref mut command_queue , ref mut data , ref ext_event_host , ref env , .. } = self ; let mut ctx = DelegateCtx { command_queue , app_data_type : TypeId :: of :: < T > ( ) , ext_event_host , } ; delegate . as_deref_mut ( ) . map ( | delegate | f ( delegate , data , env , & mut ctx ) ) }
A helper fn for setting up the `DelegateCtx`.
A helper fn for setting up the ` DelegateCtx ` .
&mut self
f
F
&mut self
f
F