Skip to main content

RequestHandler

Trait RequestHandler 

Source
pub trait RequestHandler: Send + Sync {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        request: LambdaRequest,
    ) -> Pin<Box<dyn Future<Output = LambdaResponse> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The contract LambdaRuntime drives.

Implemented here for any Fn(LambdaRequest) -> Future<Output = LambdaResponse>. Other types implement it themselves, or via impl_lambda_handler!; there is no blanket implementation for an Armature Application.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, request: LambdaRequest, ) -> Pin<Box<dyn Future<Output = LambdaResponse> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle an HTTP request.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, Fut> RequestHandler for F
where F: Fn(LambdaRequest) -> Fut + Send + Sync, Fut: Future<Output = LambdaResponse> + Send,

Example implementation for a simple handler function.