pub enum FallbackStrategy<Req, Res, E> {
Value(Res),
ValueFn(ValueFn<Res>),
FromError(FromErrorFn<Res, E>),
FromRequestError(FromRequestErrorFn<Req, Res, E>),
Service(ServiceFn<Req, Res, E>),
Exception(ExceptionFn<E>),
}Expand description
The strategy used to produce a fallback response.
Variants§
Value(Res)
Return a static value (cloned for each fallback).
ValueFn(ValueFn<Res>)
Generate a value using a function (no Clone required).
FromError(FromErrorFn<Res, E>)
Compute a response from the error.
FromRequestError(FromRequestErrorFn<Req, Res, E>)
Compute a response from both the request and error.
Service(ServiceFn<Req, Res, E>)
Call a backup service asynchronously. The function takes the request and returns a future.
Exception(ExceptionFn<E>)
Transform the error into a different error (still fails, but with transformed error).
Trait Implementations§
Auto Trait Implementations§
impl<Req, Res, E> Freeze for FallbackStrategy<Req, Res, E>where
Res: Freeze,
impl<Req, Res, E> !RefUnwindSafe for FallbackStrategy<Req, Res, E>
impl<Req, Res, E> Send for FallbackStrategy<Req, Res, E>where
Res: Send,
impl<Req, Res, E> Sync for FallbackStrategy<Req, Res, E>where
Res: Sync,
impl<Req, Res, E> Unpin for FallbackStrategy<Req, Res, E>where
Res: Unpin,
impl<Req, Res, E> UnsafeUnpin for FallbackStrategy<Req, Res, E>where
Res: UnsafeUnpin,
impl<Req, Res, E> !UnwindSafe for FallbackStrategy<Req, Res, E>
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