Skip to main content

impl_lambda_handler

Macro impl_lambda_handler 

Source
macro_rules! impl_lambda_handler {
    ($app_type:ty) => { ... };
}
Expand description

Implement RequestHandler for a type that already exposes an inherent async handle_request method.

This macro knows nothing about armature_core::Application; there is no conversion in this crate between armature_core’s HttpRequest/ HttpResponse and the Lambda event types. What it targets is a user-supplied shape:

impl MyApp {
    async fn handle_request(
        &self,
        request: armature_lambda::LambdaRequest,
    ) -> Result<MyResponse, MyError> { /* ... */ }
}

where MyResponse has the fields

  • status: u16,
  • body: impl Into<bytes::Bytes>,
  • headers: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,

and MyError: std::fmt::Display. Given that, expand the macro once per type:

use armature_lambda::impl_lambda_handler;

impl_lambda_handler!(MyApp);

If your application is an Armature Application, write that handle_request adapter yourself — the macro only removes the trait boilerplate around it.