Trait gotham::handler::Handler [] [src]

pub trait Handler: Send {
    fn handle(self, state: State, request: Request) -> Box<HandlerFuture>;
}

A Handler receives some subset of requests to the application, and returns a future which resolves to a response. This represents the common entry point for the parts of a Gotham application, implemented by Router and Pipeline.

The Handler is created by its NewHandler implementation, and is used for a single request.

A Handler is basically an asynchronous function. To anybody familiar with tokio's documentation, this explanation will sound familiar as it's exactly the description of a tokio Service

Required Methods

Handles the request, returning a boxed future which resolves to a response.

Implementors