Function spirit_hyper::service_fn_ok [−][src]
pub fn service_fn_ok<F, S, O, C, ExtraCfg>(
f: F
) -> impl ConnAction<S, O, C, ExtraCfg, IntoFuture = Result<(impl Service<ReqBody = Body, Future = impl Send> + Send, Http), FailError>> where
F: Fn(&Arc<Spirit<S, O, C>>, Request<Body>, &ExtraCfg) -> Response<Body> + Send + Sync + 'static,
ExtraCfg: Clone + Debug + PartialEq + Send + 'static,
S: Borrow<ArcSwap<C>> + Sync + Send + 'static,
C: Deserialize<'de> + Send + Sync + 'static,
O: Debug + StructOpt + Sync + Send + 'static,
A helper to create a ConnAction
from a function (or closure).
This turns a Fn(&Arc<Spirit>, &Request<Body>, &ExtraCfg) -> Response<Body>
into a
ConnAction
, so it can be fed into cfg_helper
.