pub(crate) fn on<R>(
        &mut self,
        f: fn(GlobalStateSnapshot, R::Params) -> Result<R::Result>,
    ) -> &mut Self
    where
        R: lsp_types::request::Request + 'static,
        R::Params: DeserializeOwned + panic::UnwindSafe + Send + fmt::Debug + 'static,
        R::Result: Serialize + 'static,
    {
        let (id, params) = match self.parse::<R>() {
            Some(it) => it,
            None => return self,
        };

        self.global_state.task_pool.handle.spawn({
            let world = self.global_state.snapshot();
            move || {
                let result = panic::catch_unwind(move || {
                    let _pctx = stdx::panic_context::enter(format!(
                        "\nversion: {}\nrequest: {} {:#?}",
                        env!("REV"),
                        R::METHOD,
                        params
                    ));
                    f(world, params)
                });
                let response = result_to_response::<R>(id, result);
                Task::Response(response)
            }
        });

        self
    }
/// Dispatches the request onto thread pool
Dispatches the request onto thread pool
Dispatches the request onto thread pool
pub(crate) fn on<R>(
        &mut self,
        f: fn(GlobalStateSnapshot, R::Params) -> Result<R::Result>,
    ) -> &mut Self
    where
        R: lsp_types::request::Request + 'static,
        R::Params: DeserializeOwned + panic::UnwindSafe + Send + fmt::Debug + 'static,
        R::Result: Serialize + 'static,
    {
        let (id, params) = match self.parse::<R>() {
            Some(it) => it,
            None => return self,
        };
        self.global_state.task_pool.handle.spawn({
            let world = self.global_state.snapshot();
            move || {
                let result = panic::catch_unwind(move || {
                    let _pctx = stdx::panic_context::enter(format!(
                        "\nversion: {}\nrequest: {} {:#?}",
                        env!("REV"),
                        R::METHOD,
                        params
                    ));
                    f(world, params)
                });
                let response = result_to_response::<R>(id, result);
                Task::Response(response)
            }
        });
        self
    }
pub ( crate ) fn on < R > ( & mut self , f : fn ( GlobalStateSnapshot , R :: Params ) -> Result < R :: Result > , ) -> & mut Self where R : lsp_types :: request :: Request + ' static , R :: Params : DeserializeOwned + panic :: UnwindSafe + Send + fmt :: Debug + ' static , R :: Result : Serialize + ' static , { let ( id , params ) = match self . parse :: < R > ( ) { Some ( it ) => it , None => return self , } ; self . global_state . task_pool . handle . spawn ( { let world = self . global_state . snapshot ( ) ; move | | { let result = panic :: catch_unwind ( move | | { let _pctx = stdx :: panic_context :: enter ( format ! ( " \n \n " env ( " " ) R METHOD params ) ) ; f ( world , params ) } ) ; let response = result_to_response :: < R > ( id , result ) ; Task :: Response ( response ) } } ) ; self }
Dispatches the request onto thread pool
Dispatches the request onto thread pool
&mut self
f
fn(GlobalStateSnapshot, R::Params) -> Result<R::Result>