Function spirit_hyper::server_simple
source · pub fn server_simple<R, O, C, S, Fut, 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>) -> Fut + Clone + Send + Sync + 'static,
Fut: IntoFuture<Item = Response<B>> + Send + 'static,
Fut::Future: Send + 'static,
Fut::Error: Into<Box<dyn Error + Send + Sync>>,
B: Payload,
Expand description
Creates a hyper ResourceConfig
for a closure that returns a future of Response
.
This is like server
, but the passed parameter is
Fn(Request) -> impl Future<Item = Response>
. This means it is not passed any configuration
from spirit
. It also needs to be cloneable.