Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with axum #94

Closed
1787611685 opened this issue Dec 15, 2024 · 2 comments
Closed

error with axum #94

1787611685 opened this issue Dec 15, 2024 · 2 comments

Comments

@1787611685
Copy link

I used the example you gave, but got an error. Here is the error message:
error[E0277]: the trait bound fn(IncomingUpgrade) -> impl Future<Output = impl IntoResponse> {ws_handler}: Handler<_, _> is not satisfied
--> src/main.rs:8:44
|
8 | let app = Router::new().route("/", get(ws_handler));
| --- ^^^^^^^^^^ the trait Handler<_, _> is not implemented for fn item fn(IncomingUpgrade) -> impl Future<Output = impl IntoResponse> {ws_handler}
| |
| required by a bound introduced by this call
|
= note: Consider using #[axum::debug_handler] to improve the error message
= help: the following other types implement trait Handler<T, S>:
Layered<L, H, T, S> implements Handler<T, S>
MethodRouter<S> implements Handler<(), S>
note: required by a bound in axum::routing::get
--> C:\Users\Administrator.cargo\registry\src\index.crates.io-6f17d22bba15001f\axum-0.8.0-alpha.1\src\routing\method_routing.rs:386:1
|
386 | top_level_handler_fn!(get, GET);
| ^^^^^^^^^^^^^^^^^^^^^^---^^^^^^
| | |
| | required by a bound in this function
| required by this bound in get
= note: this error originates in the macro top_level_handler_fn (in Nightly builds, run with -Z macro-backtrace for more info)

@papiro
Copy link

papiro commented Dec 16, 2024

when you add fastwebsockets to your project you need to add the with_axum feature.

cargo add fastwebsockets -F with_axum

@littledivy
Copy link
Member

Closing as resolved. with_axum feature needs to be enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants