Closed JonnyJiang123 closed 3 months ago
Here is Param struct definition
Try adding axum::debug_handler
as an attribute to your handler. It should give you a better error. I suspect your return type doesn't implement IntoResponse
because you should use http::StatusCode
instead of the reqwest
one. But really, do try the attribute if it gives you other suggestions.
Also next time please use GitHub discussions for questions like this rather than opening an issue.
v
I changed, but it was error just like before.
I try to add debug_handler macro, but it also error. error is
I solved it! Ok, it is not easy! When use std::sync::Mutext in asyn block like tokio, it is seem has some problems,but it can replaced with tokio::sync::Mutex. The whole code are as follow:
That's nice that you figured it out. For some further info on the different kinds of mutexes, see tokio's documentation.
Also in the future, please avoid posting screenshots of code, and use code blocks like you did for the Cargo.toml
in the issue description.
thank you!
How can I resolve it? It just like official sample, but I got an error:
Bug Report
Version
├── axum v0.7.5 │ ├── axum-core v0.4.3
Platform
stable-aarch64-apple-darwin unchanged - rustc 1.80.0 (051478957 2024-07-21) macos version 14.5 (23F79) macbook m1 pro
Crates
Description
Handler<, >
is not satisfied the following other types implement trait
Handler<T, S>`:I tried this code:
and error is