Services and NewServices
Serviceis a trait representing an asynchronous function of a request to a response. It's similar to
async fn(Request) -> Result<Response, Error>.
NewServiceis a trait creating specific instances of a
These types are conceptually similar to those in tower, while being specific to hyper.
In hyper, especially in the server setting, a
Service is usually bound
to a single connection. It defines how to respond to all requests that
connection will receive.
Service is bound to a single connection, a
needs a way to make them as it accepts connections. This is what a
Resources that need to be shared by all
Services can be put into a
NewService, and then passed to individual
An asynchronous constructor of
An asynchronous function from