dipper

Trait Handler

source
pub trait Handler:
    Send
    + Sync
    + 'static {
    // Required method
    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 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn hooped<H>(self) -> HoopedHandler
       where H: Handler,
             Self: Sized { ... }
    fn hoop<H>(self, hoop: H) -> HoopedHandler
       where H: Handler,
             Self: Sized { ... }
    fn hoop_when<H, F>(self, hoop: H, filter: F) -> HoopedHandler
       where Self: Sized,
             H: Handler,
             F: Fn(&Request, &Depot) -> bool + Send + Sync + 'static { ... }
}
Expand description

Handler is used for handle Request.

View module level documentation for more details.

Required Methods§

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Handle http request.

Provided Methods§

source

fn hooped<H>(self) -> HoopedHandler
where H: Handler, Self: Sized,

Wrap to HoopedHandler.

source

fn hoop<H>(self, hoop: H) -> HoopedHandler
where H: Handler, Self: Sized,

Hoop this handler with middleware.

source

fn hoop_when<H, F>(self, hoop: H, filter: F) -> HoopedHandler
where Self: Sized, H: Handler, F: Fn(&Request, &Depot) -> bool + Send + Sync + 'static,

Hoop this handler with middleware.

This middleware only effective when the filter return true.

Implementations on Foreign Types§

source§

impl Handler for Metrics

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Metrics: 'async_trait,

source§

impl<A> Handler for (A,)
where A: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A,): 'async_trait,

source§

impl<A, B> Handler for (A, B)
where A: Handler, B: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A, B): 'async_trait,

source§

impl<A, B, C> Handler for (A, B, C)
where A: Handler, B: Handler, C: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A, B, C): 'async_trait,

source§

impl<A, B, C, D> Handler for (A, B, C, D)
where A: Handler, B: Handler, C: Handler, D: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A, B, C, D): 'async_trait,

source§

impl<A, B, C, D, E> Handler for (A, B, C, D, E)
where A: Handler, B: Handler, C: Handler, D: Handler, E: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A, B, C, D, E): 'async_trait,

source§

impl<A, B, C, D, E, F> Handler for (A, B, C, D, E, F)
where A: Handler, B: Handler, C: Handler, D: Handler, E: Handler, F: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A, B, C, D, E, F): 'async_trait,

source§

impl<A, B, C, D, E, F, G> Handler for (A, B, C, D, E, F, G)
where A: Handler, B: Handler, C: Handler, D: Handler, E: Handler, F: Handler, G: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A, B, C, D, E, F, G): 'async_trait,

source§

impl<A, B, C, D, E, F, G, H> Handler for (A, B, C, D, E, F, G, H)
where A: Handler, B: Handler, C: Handler, D: Handler, E: Handler, F: Handler, G: Handler, H: Handler,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, (A, B, C, D, E, F, G, H): 'async_trait,

source§

impl<T> Handler for Tracing<T>
where T: Tracer + Sync + Send + 'static, <T as Tracer>::Span: Send + Sync + 'static,

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 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Tracing<T>: 'async_trait,

Implementors§