Struct salvo_extra::timeout::Timeout
source · pub struct Timeout { /* private fields */ }
Available on crate feature
timeout
only.Expand description
Middleware for controlling request timeout.
View module level documentation for more details.
Implementations§
source§impl Timeout
impl Timeout
sourcepub fn error(
self,
error: impl Fn() -> StatusError + Send + Sync + 'static,
) -> Self
pub fn error( self, error: impl Fn() -> StatusError + Send + Sync + 'static, ) -> Self
Custom error returned when timeout.
By default, a 503 Service Unavailable
error is returned. You can set this function to other error types,
such as 403 Request Timeout
, but the 403 error code may cause the browser to automatically resend the
request multiple times.
Trait Implementations§
source§impl Handler for Timeout
impl Handler for Timeout
source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Auto Trait Implementations§
impl Freeze for Timeout
impl !RefUnwindSafe for Timeout
impl Send for Timeout
impl Sync for Timeout
impl Unpin for Timeout
impl !UnwindSafe for Timeout
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more