fn on_sync<R>(
        &mut self,
        f: fn(&mut WorldState, R::Params) -> Result<R::Result>,
    ) -> Result<&mut Self>
    where
        R: req::Request + 'static,
        R::Params: DeserializeOwned + panic::UnwindSafe + 'static,
        R::Result: Serialize + 'static,
    {
        let (id, params) = match self.parse::<R>() {
            Some(it) => it,
            None => {
                return Ok(self);
            }
        };
        let world = panic::AssertUnwindSafe(&mut *self.world);
        let task = panic::catch_unwind(move || {
            let result = f(world.0, params);
            result_to_task::<R>(id, result)
        })
        .map_err(|_| format!("sync task {:?} panicked", R::METHOD))?;
        on_task(task, self.msg_sender, self.pending_requests, self.world);
        Ok(self)
    }
/// Dispatches the request onto the current thread
Dispatches the request onto the current thread
Dispatches the request onto the current thread
fn on_sync<R>(
        &mut self,
        f: fn(&mut WorldState, R::Params) -> Result<R::Result>,
    ) -> Result<&mut Self>
    where
        R: req::Request + 'static,
        R::Params: DeserializeOwned + panic::UnwindSafe + 'static,
        R::Result: Serialize + 'static,
    {
        let (id, params) = match self.parse::<R>() {
            Some(it) => it,
            None => {
                return Ok(self);
            }
        };
        let world = panic::AssertUnwindSafe(&mut *self.world);
        let task = panic::catch_unwind(move || {
            let result = f(world.0, params);
            result_to_task::<R>(id, result)
        })
        .map_err(|_| format!("sync task {:?} panicked", R::METHOD))?;
        on_task(task, self.msg_sender, self.pending_requests, self.world);
        Ok(self)
    }
fn on_sync < R > ( & mut self , f : fn ( & mut WorldState , R :: Params ) -> Result < R :: Result > , ) -> Result < & mut Self > where R : req :: Request + ' static , R :: Params : DeserializeOwned + panic :: UnwindSafe + ' static , R :: Result : Serialize + ' static , { let ( id , params ) = match self . parse :: < R > ( ) { Some ( it ) => it , None => { return Ok ( self ) ; } } ; let world = panic :: AssertUnwindSafe ( & mut * self . world ) ; let task = panic :: catch_unwind ( move | | { let result = f ( world . 0 , params ) ; result_to_task :: < R > ( id , result ) } ) . map_err ( | _ | format ! ( " " R METHOD ) ) ? ; on_task ( task , self . msg_sender , self . pending_requests , self . world ) ; Ok ( self ) }
Dispatches the request onto the current thread
Dispatches the request onto the current thread
&mut self
f
fn(&mut WorldState, R::Params) -> Result<R::Result>