Trait viz_core::Handler

source ·
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§

source

type Output

The returned type after the call operator is used.

Required Methods§

source

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,

Performs the call operation.

Implementors§

source§

impl Handler<Request<Body>> for BoxHandler

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,

§

type Output = <Fut as Future>::Output

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,

§

type Output = <H as FnExt<E>>::Output

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,

§

type Output = <F as Handler<Result<O, Error>>>::Output

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,

§

type Output = <F as Handler<O>>::Output

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,

§

type Output = <F as Handler<(I, H)>>::Output

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,

§

type Output = <H as Handler<I>>::Output

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,

§

type Output = <H as Handler<I>>::Output

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,

§

type Output = <H as Handler<I>>::Output

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,

§

type Output = <F as Handler<Error>>::Output

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,

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,

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,

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.
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.
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.
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.
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.
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.
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.
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.
source§

impl<H, O, T> Handler<Request<Body>> for State<(H, T)>where O: IntoResponse, H: Handler<Request, Output = Result<O>> + Clone, T: Clone + Send + Sync + 'static,

Available on crate feature state only.
source§

impl<L, R, I, O> Handler<I> for Either<L, R>where I: Send + 'static, L: Handler<I, Output = O> + Clone, R: Handler<I, Output = O> + Clone,

§

type Output = O