Trait humphrey::app::PathAwareRequestHandler [−][src]
pub trait PathAwareRequestHandler<State>: Fn(Request, Arc<State>, &str) -> Response + Send + Sync { }
Expand description
Represents a function able to handle a request with respect to the route it was called from. It is passed the request, the app’s state, and the route it was called from, and must return a response.
Example
The most basic path-aware request handler would be as follows:
fn handler(request: Request, _: Arc<()>, route: &str) -> Response {
Response::new(StatusCode::OK, format!("Success matching route {}", route), &request)
}