Skip to content

How to wrap a Handler into another one #373

Closed
@nmoutschen

Description

@nmoutschen

Hey folks!

I'm doing a proof-of-concept of wrapping a lambda_runtime::Handler into another one. The idea is that I could then add and chain capabilities with a nice interface.

However, I'm facing an issue in how I call the actual function, since the Handler trait has a synchronous function call() that returns a Future. That means that I cannot await the function's call and then do something with the result. How could I handle that?

Here's the POC I currently have, with the problem highlighted: https://gist.github.com/nmoutschen/5a264d1d2d246d265517962ff91cba8c#file-wrap_handler-rs-L33

If I wrap the call into an async {} block, I then get the following error:

mismatched types
expected type parameter `Fut`
      found opaque type `impl Future`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions