Trait viz::Handler

source ·
pub trait Handler<Input>: 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 'life0: 'async_trait,
             Self: '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 'life0: 'async_trait, Self: 'async_trait,

Performs the call operation.

Implementors§

source§

impl Handler<Request<Body>> for Prometheus

source§

impl Handler<Request<Body>> for viz::handlers::serve::Dir

source§

impl Handler<Request<Body>> for viz::handlers::serve::File

source§

impl<E> Handler<Request<Body>> for viz::handlers::embed::Dir<E>
where E: RustEmbed + Send + Sync + 'static,

source§

impl<E> Handler<Request<Body>> for viz::handlers::embed::File<E>
where E: RustEmbed + Send + Sync + 'static,

source§

impl<F, I, Fut, O> Handler<I> for F
where I: Send + 'static, F: Fn(I) -> Fut + Clone + Send + Sync + 'static + ?Sized, Fut: Future<Output = O> + Send,

§

type Output = <Fut as Future>::Output

source§

impl<H, F, I, O> Handler<I> for After<H, F>
where I: Send + 'static, H: Handler<I, Output = Result<O, Error>>, F: Handler<<H as Handler<I>>::Output, Output = <H as Handler<I>>::Output>,

§

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

source§

impl<H, F, I, O> Handler<I> for AndThen<H, F>
where I: Send + 'static, H: Handler<I, Output = Result<O, Error>>, F: Handler<O, Output = <H as Handler<I>>::Output>, O: Send,

§

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, Error>> + Clone, F: Handler<(I, H), Output = <H as Handler<I>>::Output>,

§

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, Error>>, H: Handler<I, Output = Result<O, Error>>,

§

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

source§

impl<H, F, I, O> Handler<I> for OrElse<H, F>
where I: Send + 'static, H: Handler<I, Output = Result<O, Error>>, F: Handler<Error, Output = <H as Handler<I>>::Output>, O: Send,

§

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

source§

impl<H, F, I, O, E> Handler<I> for MapErr<H, F>
where I: Send + 'static, H: Handler<I, Output = Result<O, E>>, F: FnOnce(E) -> Error + Send + Sync + Copy + 'static,

§

type Output = Result<O, Error>

source§

impl<H, F, I, O, R> Handler<I> for CatchUnwind<H, F>
where I: Send + 'static, H: Handler<I, Output = Result<O, Error>>, O: IntoResponse + Send, F: Handler<Box<dyn Any + Send>, Output = R>, R: IntoResponse,

source§

impl<H, F, I, O, T> Handler<I> for Map<H, F>
where I: Send + 'static, H: Handler<I, Output = Result<O, Error>>, F: FnOnce(O) -> T + Send + Sync + Copy + 'static,

§

type Output = Result<T, Error>

source§

impl<H, I, O> Handler<I> for MapInToResponse<H>
where I: Send + 'static, H: Handler<I, Output = Result<O, Error>>, O: IntoResponse,

source§

impl<H, I, O, F, E, R> Handler<I> for CatchError<H, F, E, R>
where I: Send + 'static, H: Handler<I, Output = Result<O, Error>>, O: IntoResponse + Send, E: Error + Send + 'static, F: Handler<E, Output = R>, R: IntoResponse + 'static,

source§

impl<H, O> Handler<Request<Body>> for CompressionMiddleware<H>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse,

source§

impl<H, O> Handler<Request<Body>> for CookieMiddleware<H>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse,

source§

impl<H, O> Handler<Request<Body>> for CorsMiddleware<H>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse,

source§

impl<H, O> Handler<Request<Body>> for LimitsMiddleware<H>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse,

source§

impl<H, O> Handler<Request<Body>> for MetricsMiddleware<H>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse,

source§

impl<H, O, S, G, V> Handler<Request<Body>> for CsrfMiddleware<H, S, G, V>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse, S: Fn() -> Result<Vec<u8>, Error> + Send + Sync + 'static, G: Fn(&[u8], Vec<u8>) -> Vec<u8> + Send + Sync + 'static, V: Fn(&[u8], String) -> bool + Send + Sync + 'static,

source§

impl<H, O, S, G, V> Handler<Request<Body>> for SessionMiddleware<H, S, G, V>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse, S: Storage + 'static, G: Fn() -> String + Send + Sync + 'static, V: Fn(&str) -> bool + Send + Sync + 'static,

source§

impl<H, O, T> Handler<Request<Body>> for TracingMiddleware<H, T>
where H: Handler<Request<Body>, Output = Result<O, Error>>, O: IntoResponse, T: Tracer + Send + Sync + Clone + 'static, <T as Tracer>::Span: Send + Sync + 'static,

source§

impl<I, H, E, O> Handler<I> for FnExtHandler<H, E, O>
where I: Send + 'static, E: FromRequest + 'static, <E as FromRequest>::Error: IntoResponse, H: FnExt<I, E, Output = Result<O, Error>>, O: 'static,

§

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

source§

impl<I, O> Handler<I> for BoxHandler<I, O>
where I: Send + 'static, O: 'static,

§

type Output = O

source§

impl<I, O, S> Handler<Request<I>> for ServiceHandler<S>
where I: Body + Send + 'static, O: Body + Send + 'static, <O as Body>::Data: Into<Bytes>, <O as Body>::Error: Into<Box<dyn Error + Sync + Send>>, S: Service<Request<I>, Response = Response<O>> + Send + Sync + 'static, <S as Service<Request<I>>>::Future: Send, <S as Service<Request<I>>>::Error: Into<Box<dyn Error + Sync + Send>>,

source§

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

§

type Output = O

source§

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