Trait humphrey::app::RequestHandler[][src]

pub trait RequestHandler<State>: Fn(Request, Arc<State>) -> Response + Send + Sync { }
Expand description

Represents a function able to handle a request. It is passed the request as well as the app’s state, and must return a response.

Example

The most basic request handler would be as follows:

fn handler(request: Request, _: Arc<()>) -> Response {
    Response::new(StatusCode::OK, b"Success", &request)
}

Implementors