Trait spin_sdk::http::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

Exports HTTP Router items. 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,