pub trait Handler<Input>: DynClone + Send + Sync + 'static {
type Output;
// Required method
fn call<'life0, 'async_trait>(
&'life0 self,
input: Input
) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A simplified asynchronous interface for handling input and output.
Composable request handlers.
Required Associated Types§
Required Methods§
Implementors§
source§impl<F, I, Fut, O> Handler<I> for Fwhere
I: Send + 'static,
F: Fn(I) -> Fut + ?Sized + Clone + Send + Sync + 'static,
Fut: Future<Output = O> + Send,
impl<F, I, Fut, O> Handler<I> for Fwhere I: Send + 'static, F: Fn(I) -> Fut + ?Sized + Clone + Send + Sync + 'static, Fut: Future<Output = O> + Send,
source§impl<H, E, O> Handler<Request<Body>> for FnExtHandler<H, E, O>where
E: FromRequest + Send + Sync + 'static,
E::Error: IntoResponse + Send + Sync,
H: FnExt<E, Output = Result<O>>,
O: Send + Sync + 'static,
impl<H, E, O> Handler<Request<Body>> for FnExtHandler<H, E, O>where E: FromRequest + Send + Sync + 'static, E::Error: IntoResponse + Send + Sync, H: FnExt<E, Output = Result<O>>, O: Send + Sync + 'static,
source§impl<H, F, I, O> Handler<I> for After<H, F>where
I: Send + 'static,
O: Send,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<Result<O>, Output = Result<O>> + Clone,
impl<H, F, I, O> Handler<I> for After<H, F>where I: Send + 'static, O: Send, H: Handler<I, Output = Result<O>> + Clone, F: Handler<Result<O>, Output = Result<O>> + Clone,
source§impl<H, F, I, O> Handler<I> for AndThen<H, F>where
I: Send + 'static,
O: Send,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<O, Output = H::Output> + Clone,
impl<H, F, I, O> Handler<I> for AndThen<H, F>where I: Send + 'static, O: Send, H: Handler<I, Output = Result<O>> + Clone, F: Handler<O, Output = H::Output> + Clone,
source§impl<H, F, I, O> Handler<I> for Around<H, F>where
I: Send + 'static,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<Next<I, H>, Output = H::Output> + Clone,
impl<H, F, I, O> Handler<I> for Around<H, F>where I: Send + 'static, H: Handler<I, Output = Result<O>> + Clone, F: Handler<Next<I, H>, Output = H::Output> + Clone,
source§impl<H, F, I, O> Handler<I> for Before<H, F>where
I: Send + 'static,
F: Handler<I, Output = Result<I>> + Clone,
H: Handler<I, Output = Result<O>> + Clone,
impl<H, F, I, O> Handler<I> for Before<H, F>where I: Send + 'static, F: Handler<I, Output = Result<I>> + Clone, H: Handler<I, Output = Result<O>> + Clone,
source§impl<H, F, I, O> Handler<I> for Map<H, F>where
I: Send + 'static,
O: Send,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<O, Output = O> + Clone,
impl<H, F, I, O> Handler<I> for Map<H, F>where I: Send + 'static, O: Send, H: Handler<I, Output = Result<O>> + Clone, F: Handler<O, Output = O> + Clone,
source§impl<H, F, I, O> Handler<I> for MapErr<H, F>where
I: Send + 'static,
O: Send,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<Error, Output = Error> + Clone,
impl<H, F, I, O> Handler<I> for MapErr<H, F>where I: Send + 'static, O: Send, H: Handler<I, Output = Result<O>> + Clone, F: Handler<Error, Output = Error> + Clone,
source§impl<H, F, I, O> Handler<I> for OrElse<H, F>where
I: Send + 'static,
O: Send,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<Error, Output = H::Output> + Clone,
impl<H, F, I, O> Handler<I> for OrElse<H, F>where I: Send + 'static, O: Send, H: Handler<I, Output = Result<O>> + Clone, F: Handler<Error, Output = H::Output> + Clone,
source§impl<H, F, I, O, R> Handler<I> for CatchUnwind<H, F>where
I: Send + 'static,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<Box<dyn Any + Send>, Output = R> + Clone,
O: IntoResponse + Send + Sync + 'static,
R: IntoResponse + Send + Sync + 'static,
impl<H, F, I, O, R> Handler<I> for CatchUnwind<H, F>where I: Send + 'static, H: Handler<I, Output = Result<O>> + Clone, F: Handler<Box<dyn Any + Send>, Output = R> + Clone, O: IntoResponse + Send + Sync + 'static, R: IntoResponse + Send + Sync + 'static,
source§impl<H, F, I, O, R, E> Handler<I> for CatchError<H, F, E, R>where
I: Send + 'static,
O: IntoResponse + Send,
H: Handler<I, Output = Result<O>> + Clone,
F: Handler<E, Output = R> + Clone,
R: IntoResponse + Send + Sync + 'static,
E: Error + Send + Sync + 'static,
impl<H, F, I, O, R, E> Handler<I> for CatchError<H, F, E, R>where I: Send + 'static, O: IntoResponse + Send, H: Handler<I, Output = Result<O>> + Clone, F: Handler<E, Output = R> + Clone, R: IntoResponse + Send + Sync + 'static, E: Error + Send + Sync + 'static,
source§impl<H, I, O> Handler<I> for MapInToResponse<H, O>where
I: Send + 'static,
H: Handler<I, Output = Result<O>> + Clone,
O: IntoResponse + Send + Sync + 'static,
impl<H, I, O> Handler<I> for MapInToResponse<H, O>where I: Send + 'static, H: Handler<I, Output = Result<O>> + Clone, O: IntoResponse + Send + Sync + 'static,
source§impl<H, O> Handler<Request<Body>> for CompressionMiddleware<H>where
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature compression
only.
impl<H, O> Handler<Request<Body>> for CompressionMiddleware<H>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature
compression
only.source§impl<H, O> Handler<Request<Body>> for CookieMiddleware<H>where
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature cookie
only.
impl<H, O> Handler<Request<Body>> for CookieMiddleware<H>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature
cookie
only.source§impl<H, O> Handler<Request<Body>> for CorsMiddleware<H>where
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature cors
only.
impl<H, O> Handler<Request<Body>> for CorsMiddleware<H>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature
cors
only.source§impl<H, O> Handler<Request<Body>> for LimitsMiddleware<H>where
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature limits
only.
impl<H, O> Handler<Request<Body>> for LimitsMiddleware<H>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone,
Available on crate feature
limits
only.source§impl<H, O> Handler<Request<Body>> for MetricsMiddleware<H>where
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
Available on crate features otel-metrics
and otel
only.
impl<H, O> Handler<Request<Body>> for MetricsMiddleware<H>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone,
Available on crate features
otel-metrics
and otel
only.source§impl<H, O, S, G, V> Handler<Request<Body>> for CsrfMiddleware<H, S, G, V>where
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
S: Fn() -> Result<Vec<u8>> + Send + Sync + 'static,
G: Fn(&[u8], Vec<u8>) -> Vec<u8> + Send + Sync + 'static,
V: Fn(Vec<u8>, String) -> bool + Send + Sync + 'static,
Available on crate feature csrf
only.
impl<H, O, S, G, V> Handler<Request<Body>> for CsrfMiddleware<H, S, G, V>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone, S: Fn() -> Result<Vec<u8>> + Send + Sync + 'static, G: Fn(&[u8], Vec<u8>) -> Vec<u8> + Send + Sync + 'static, V: Fn(Vec<u8>, String) -> bool + Send + Sync + 'static,
Available on crate feature
csrf
only.source§impl<H, O, S, G, V> Handler<Request<Body>> for SessionMiddleware<H, S, G, V>where
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
S: Storage + 'static,
G: Fn() -> String + Send + Sync + 'static,
V: Fn(&str) -> bool + Send + Sync + 'static,
Available on crate feature session
only.
impl<H, O, S, G, V> Handler<Request<Body>> for SessionMiddleware<H, S, G, V>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone, S: Storage + 'static, G: Fn() -> String + Send + Sync + 'static, V: Fn(&str) -> bool + Send + Sync + 'static,
Available on crate feature
session
only.source§impl<H, O, T> Handler<Request<Body>> for TracingMiddleware<H, T>where
T: Tracer + Send + Sync + Clone + 'static,
T::Span: Send + Sync + 'static,
O: IntoResponse,
H: Handler<Request, Output = Result<O>> + Clone,
Available on crate features otel-tracing
and otel
only.
impl<H, O, T> Handler<Request<Body>> for TracingMiddleware<H, T>where T: Tracer + Send + Sync + Clone + 'static, T::Span: Send + Sync + 'static, O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone,
Available on crate features
otel-tracing
and otel
only.