Problems with type inference #2179
Answered
by
davidpdrsn
GigaFirmDev
asked this question in
Q&A
-
Lately, I was dealing with this problem where rust cannot infer the type generics of the route. I even had to resort to axum examples to check if it was a mistake but the result stayed the same: let app = Router::new()
// `GET /` goes to `root`
.route("/", get(root))
// `POST /users` goes to `create_user`
.route("/users", post(create_user)); This is the portion of the code that is causing me trouble. This is what rust said about it:
|
Beta Was this translation helpful? Give feedback.
Answered by
davidpdrsn
Aug 17, 2023
Replies: 1 comment 7 replies
-
If you actually run the router with axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap(); the compile is able to infer the types. |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
davidpdrsn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you actually run the router with
the compile is able to infer the types.