Trait Handler

Source
pub trait Handler {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        req: Request,
        params: Params,
    ) -> Pin<Box<dyn Future<Output = Response> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An HTTP request handler.

This trait is automatically implemented for Fn types, and so is rarely implemented directly by Spin users.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, req: Request, params: Params, ) -> Pin<Box<dyn Future<Output = Response> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invoke the handler.

Trait Implementations§

Source§

impl Handler for Box<dyn Handler>

Source§

fn handle<'life0, 'async_trait>( &'life0 self, req: Request, params: Params, ) -> Pin<Box<dyn Future<Output = Response> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invoke the handler.

Implementations on Foreign Types§

Source§

impl Handler for Box<dyn Handler>

Source§

fn handle<'life0, 'async_trait>( &'life0 self, req: Request, params: Params, ) -> Pin<Box<dyn Future<Output = Response> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

Source§

impl<F, Fut> Handler for F
where F: Fn(Request, Params) -> Fut + 'static, Fut: Future<Output = Response> + 'static,