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

Support for Hyper 0.14 #75

Open
bachetesla opened this issue Feb 8, 2022 · 1 comment
Open

Support for Hyper 0.14 #75

bachetesla opened this issue Feb 8, 2022 · 1 comment

Comments

@bachetesla
Copy link

Dear Bests.

I was using hyper-router for a project with hyper 0.14 version and while running the example I got this error :
I'll be happy if I can fix this problem.

 --> src/main.rs:7:5
  |
7 | use hyper::rt::Future;
  |     ^^^^^^^^^^^^^^^^^ no `Future` in `rt`

error[E0425]: cannot find function `run` in module `hyper::rt`
  --> src/main.rs:34:16
   |
34 |     hyper::rt::run(server)
   |                ^^^ not found in `hyper::rt`

error[E0308]: mismatched types
  --> src/main.rs:21:41
   |
21 |         .add(Route::get("/hello").using(request_handler))
   |                                         ^^^^^^^^^^^^^^^ expected struct `http::request::Request`, found struct `Request`
   |
   = note: expected fn pointer `fn(http::request::Request<hyper::body::body::Body>) -> http::response::Response<hyper::body::body::Body>`
                 found fn item `fn(Request<Body>) -> Response<Body> {request_handler}`

error[E0308]: mismatched types
  --> src/main.rs:22:26
   |
22 |         .add(Route::from(Method::PATCH, "/asd").using(request_handler))
   |                          ^^^^^^^^^^^^^ expected struct `http::method::Method`, found struct `Method`
   |
   = note: perhaps two different versions of crate `HTTP` are being used?

error[E0308]: mismatched types
  --> src/main.rs:22:55
   |
22 |         .add(Route::from(Method::PATCH, "/asd").using(request_handler))
   |                                                       ^^^^^^^^^^^^^^^ expected struct `http::request::Request`, found struct `Request`
   |
   = note: expected fn pointer `fn(http::request::Request<hyper::body::body::Body>) -> http::response::Response<hyper::body::body::Body>`
                 found fn item `fn(Request<Body>) -> Response<Body> {request_handler}`

error[E0277]: the trait bound `for<'a> fn() -> Result<RouterService, std::io::Error> {router_service}: Service<&'a AddrStream>` is not satisfied
  --> src/main.rs:31:16
   |
31 |         .serve(router_service)
   |          ----- ^^^^^^^^^^^^^^ the trait `for<'a> Service<&'a AddrStream>` is not implemented for `fn() -> Result<RouterService, std::io::Error> {router_service}`
   |          |
   |          required by a bound introduced by this call
   |
   = note: required because of the requirements on the impl of `hyper::service::make::MakeServiceRef<AddrStream, Body>` for `fn() -> Result<RouterService, std::io::Error> {router_service}`

error[E0599]: no method named `map_err` found for struct `Server` in the current scope
  --> src/main.rs:32:10
   |
32 |         .map_err(|e| eprintln!("server error: {}", e));
   |          ^^^^^^^ method not found in `Server<AddrIncoming, fn() -> Result<RouterService, std::io::Error> {router_service}>`

@brandonros
Copy link

Any solution?

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

2 participants