-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
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}>`
Metadata
Metadata
Assignees
Labels
No labels