fn on<R>(&mut self, f: fn(WorldSnapshot, R::Params) -> Result<R::Result>) -> Result<&mut Self>
    where
        R: req::Request + 'static,
        R::Params: DeserializeOwned + Send + 'static,
        R::Result: Serialize + 'static,
    {
        let (id, params) = match self.parse::<R>() {
            Some(it) => it,
            None => {
                return Ok(self);
            }
        };

        self.pool.execute({
            let world = self.world.snapshot();
            let sender = self.task_sender.clone();
            move || {
                let result = f(world, params);
                let task = result_to_task::<R>(id, result);
                sender.send(task).unwrap();
            }
        });

        Ok(self)
    }
/// Dispatches the request onto thread pool
Dispatches the request onto thread pool
Dispatches the request onto thread pool
fn on<R>(&mut self, f: fn(WorldSnapshot, R::Params) -> Result<R::Result>) -> Result<&mut Self>
    where
        R: req::Request + 'static,
        R::Params: DeserializeOwned + Send + 'static,
        R::Result: Serialize + 'static,
    {
        let (id, params) = match self.parse::<R>() {
            Some(it) => it,
            None => {
                return Ok(self);
            }
        };
        self.pool.execute({
            let world = self.world.snapshot();
            let sender = self.task_sender.clone();
            move || {
                let result = f(world, params);
                let task = result_to_task::<R>(id, result);
                sender.send(task).unwrap();
            }
        });
        Ok(self)
    }
fn on < R > ( & mut self , f : fn ( WorldSnapshot , R :: Params ) -> Result < R :: Result > ) -> Result < & mut Self > where R : req :: Request + ' static , R :: Params : DeserializeOwned + Send + ' static , R :: Result : Serialize + ' static , { let ( id , params ) = match self . parse :: < R > ( ) { Some ( it ) => it , None => { return Ok ( self ) ; } } ; self . pool . execute ( { let world = self . world . snapshot ( ) ; let sender = self . task_sender . clone ( ) ; move | | { let result = f ( world , params ) ; let task = result_to_task :: < R > ( id , result ) ; sender . send ( task ) . unwrap ( ) ; } } ) ; Ok ( self ) }
Dispatches the request onto thread pool
Dispatches the request onto thread pool
&mut self
f
fn(WorldSnapshot, R::Params) -> Result<R::Result>