Skip to main content

timeout

Function timeout 

Source
pub fn timeout(duration: Duration) -> TimeoutLayer
Expand description

Returns a layer that fails requests which are not completed within the given duration.

Requests that exceed the timeout receive a 408 Request Timeout response.

Use this when composing layers on a raw axum::Router. When building via App, prefer App::timeout, which applies the same layer to all routes including stateful DI routes.