Type Definition pemmican::Handler [] [src]

type Handler<S, E> = fn(_: &Pemmican<S, E>, _: &Request) -> Box<Future<Item = Response, Error = E>>;

Handler functions handle web requests by generating a response. Code within these functions should take care not to block or call functions which may block. Instead, they should return futures immediately.

In the case of an error, if at all possible, respond to the client with a 5xx error code and return a Response rather than an Error.

A reference to pemmican will be supplied to the request, so that you have access to the services it provides (such as access to your state S and access to the thread pool).