pub fn with_timeout<F>(
duration: Duration,
handler: F,
) -> impl Fn(&Request, &PathParams, &ConnectionInfo) -> Response + Send + Sync + 'staticExpand description
Wraps a stateless handler (the Router handler signature) so it must
complete within duration or the caller gets 504 Gateway Timeout
instead of waiting further. See the module docs for the
cancellation caveat.