pub fn service<S, St, Req>(
service: impl IntoService<S, St, Req>,
) -> ServiceChain<S, St, Req>where
S: Service<St, Req>,Expand description
Starts a ServiceChain with one service.
Converts the input through IntoService and returns a builder for
composing calls, mapping results, and adding middleware. This does not
create a pipeline or check readiness; use Service::pipeline to supply
state and obtain a callable pipeline.
ยงExample
use ntex_service::{Service, fn_service, service};
let pipeline = service(fn_service(async |req: u32| Ok::<_, ()>(req + 1)))
.map(|value| value.to_string())
.pipeline(());
assert_eq!(pipeline.call(41).await?, "42");