Trait lamedh_http::Handler[][src]

pub trait Handler: Sized {
    type Error;
    type Response: IntoResponse;
    type Fut: Future<Output = Result<Self::Response, Self::Error>> + 'static;
    fn call(&mut self, event: Request, context: Context) -> Self::Fut;
}
[]

Functions serving as ALB and API Gateway REST and HTTP API handlers must conform to this type.

This can be viewed as a lambda::Handler constrained to http crate Request and Response types

Associated Types

type Error[src][]

The type of Error that this Handler will return

type Response: IntoResponse[src][]

The type of Response this Handler will return

type Fut: Future<Output = Result<Self::Response, Self::Error>> + 'static[src][]

The type of Future this Handler will return

Required methods

fn call(&mut self, event: Request, context: Context) -> Self::Fut[src][]

Function used to execute handler behavior

Implementors

impl<F, R, Fut> Handler for F where
    F: Fn(Request, Context) -> Fut,
    R: IntoResponse,
    Fut: Future<Output = Result<R, Error>> + Send + 'static, 
[src][+]

An implementation of Handler for a given closure return a Future representing the computed response

type Response = R

type Error = Error

type Fut = Fut

impl<H: Handler> Handler for Adapter<H>[src][+]

type Response = H::Response

type Error = H::Error

type Fut = H::Fut

impl<H: Handler> Handler for ProxyAdapter<H>[src][+]

type Response = H::Response

type Error = H::Error

type Fut = H::Fut