Replies: 1 comment
-
This is almost definitely an issue with the trait not enforcing the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I am trying to develop a module that I can reuse across many Axum applications where the states type is unknown. My idea is to return a router I can merge in to the main application.
Using the dependency-injection example at https://github.com/tokio-rs/axum/blob/main/examples/dependency-injection I've created the below code sample where I parameterize over the state
S
and retrieve a required dependency from the state by applying aFromRef<S>
bound.When using standard traits, the example compiles. However, as soon as I introduce an async trait and call
await
, I encounter a compile error. I tried using thedebug_handler
macro to help debug, but it gave an error stating that it doesn't support generic handlers.I experimented with the
async_trait
trait macro, and it compiled without any issues. So now I'm trying to understand why the code fails without the async_trait macro.Error
Sample code
axum version
0.7.4
Beta Was this translation helpful? Give feedback.
All reactions