Function spirit_hyper::server_ok

source ·
pub fn server_ok<R, O, C, S, B>(
    service: S
) -> impl ResourceConsumer<HyperServer<R>, O, C>where
    R: ResourceConfig<O, C>,
    R::Resource: IntoIncoming,
    <R::Resource as IntoIncoming>::Connection: AsyncRead + AsyncWrite,
    S: Fn(Request<Body>) -> Response<B> + Clone + Send + Sync + 'static,
    B: Payload,
Expand description

Creates a hyper ResourceConfig for a closure that returns the Response directly.

This is like server, but the passed parameter is Fn(Request) -> Response. This means it is not passed anything from spirit, it is synchronous and never fails. It must be cloneable.