Trait humphrey::app::StatelessRequestHandler[][src]

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

Represents a function able to handle a request. It is passed only the request, and must return a response. If you want access to the app’s state, consider using the RequestHandler trait instead.

Example

The most basic stateless request handler would be as follows:

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

Implementors