Wow! That was a lot of files. Of course, the exact content of the HTML and CSS doesn't matter for this recipe, as we're going to be focused on Rust. We've put them all in the files folder because we are going to make its contents publicly accessible by name for any client.
The basics of the server setup are the same as with the echoing recipe: create a Service with const_service and service_fn [21], match the request's method and path, and then handle the routes in different functions. When looking at our return type, however, we can notice a difference [36]:
type ResponseFuture = Box<Future<Item = Response, Error = hyper::Error>>;
We are no longer returning a Response directly, but instead, wrapping it in a Future. This allows us to not block the server when loading a file into memory; we can continue handling requests in the main thread while the file serving Future is run in the background.
When looking at our route handlers, you can...