Implementing middleware in Hyper

Dear rusted ones,

First of all this is my first time here, so apologies upfront if something
is wrong or off place.

I'm currently trying to build a Hyper based server.

My first step was to run the hello world tutorial. That worked

Then I've tried to build a 'Middleware' Service, that is, a Hyper Service
that wraps other Service. I've called it FooMiddleware, all it does it add
a 'Foo' reader to the response. It compiles fine.

Unfortunately when I try to wrap my initial hello world service, an error

Here's a link to the playground.

The error that happens is as follows:

error[E0277]: the trait bound FooMiddleware<hyper::service::service::ServiceFnOk<fn(hyper::Request<hyper::Body>) -> hyper::Response<hyper::Body> {hello_world}, hyper::Body>>: futures::Future is not satisfied

I can't understand what it means. service_fn_ok returns a Service, doesn't it?

Thank you for your help! Loving the language.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.