synchronous version of [handler_service] `handler_sync_service` run given function on a separate thread pool from the event loop and async logic of xitca-web itself. Therefore it comes with different requirement of function argument compared to [handler_service] where the arguments must be types that impl [FromRequest] trait, being thread safe with `Send` trait bound and with `'static` lifetime.
(func: F)
| 35 | /// |
| 36 | /// [handler_service]: super::handler_service |
| 37 | pub fn handler_sync_service<Arg, F, T>(func: F) -> FnService<impl AsyncFn(Arg) -> FnServiceOutput<F, T>> |
| 38 | where |
| 39 | F: Closure<T> + Send + Clone, |
| 40 | { |
| 41 | fn_build(async move |_| { |
| 42 | Ok(HandlerServiceSync { |
| 43 | func: func.clone(), |
| 44 | _p: PhantomData, |
| 45 | }) |
| 46 | }) |
| 47 | } |
| 48 | |
| 49 | type FnServiceOutput<F, T> = Result<HandlerServiceSync<F, T>, Infallible>; |
| 50 |