January 2019
Intermediate to advanced
520 pages
14h 32m
English
Since we now have a handler, we can start the server. The runtime expects a Future instance with the Future<Item = (), Error = ()> type, but the Server struct implements a Future with the hyper::Error error type. We can use this error to inform the user about issues, but in our example we'll just drop any error. As you might remember, the drop function expects a single argument of any type and returns a unit empty type. The Future trait uses the map_err method. It changes the error type using a function, which expects the original error type and returns a new one. Drop an error from the server using the following:
let server = server.map_err(drop);
We now have everything we need and can start the
Read now
Unlock full access