Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate iron;
- extern crate router;
- use iron::prelude::*;
- use iron::status;
- use router::Router;
- fn main() {
- let mut router = Router::new();
- router.get("/", hello_world, "index");
- fn hello_world(_: &mut Request) -> IronResult<Response> {
- Ok(Response::with((status::Ok, "Hello World!")))
- }
- Iron::new(router).http("localhost:3000").unwrap();
- println!("On 3000");
- }
- Compiling emmaramirez_me v0.0.1 (file:///C:/Users/Emma%20Ramirez/Code/emmaramirez.me)
- src\main.rs:11:12: 11:15 error: type mismatch: the type `fn(&mut iron::Request<'_, '_>) -> std::result::Result<iron::Response, iron::IronError> {main::hello_world}` implements the trait `for<'r, 'r, 'r> std::ops::Fn<(&'r mut iron::Request<'r, 'r>,)>`, but the trait `for<'r, 'r, 'r> std::ops::Fn<(&'r mut iron::request::Request<'r, 'r>,)>` is required (expected struct `iron::request::Request`, found struct `iron::Request`) [E0281]
- src\main.rs:11 router.get("/", hello_world, "index");
- ^~~
- src\main.rs:11:12: 11:15 help: run `rustc --explain E0281` to see a detailed explanation
- src\main.rs:11:12: 11:15 note: required because of the requirements on the impl of `iron::middleware::Handler` for `fn(&mut iron::Request<'_, '_>) -> std::result::Result<iron::Response, iron::IronError> {main::hello_world}`
- src\main.rs:11:12: 11:15 error: type mismatch: the type `fn(&mut iron::Request<'_, '_>) -> std::result::Result<iron::Response, iron::IronError> {main::hello_world}` implements the trait `for<'r, 'r, 'r> std::ops::FnOnce<(&'r mut iron::Request<'r, 'r>,)>`, but the trait `for<'r, 'r, 'r> std::ops::FnOnce<(&'r mut iron::request::Request<'r, 'r>,)>` is required (expected struct `iron::request::Request`, found struct `iron::Request`) [E0281]
- src\main.rs:11 router.get("/", hello_world, "index");
- ^~~
- src\main.rs:11:12: 11:15 help: run `rustc --explain E0281` to see a detailed explanation
- src\main.rs:11:12: 11:15 note: required because of the requirements on the impl of `iron::middleware::Handler` for `fn(&mut iron::Request<'_, '_>) -> std::result::Result<iron::Response, iron::IronError> {main::hello_world}`
- src\main.rs:17:5: 17:14 error: the trait bound `for<'r, 'r, 'r> router::Router: std::ops::Fn<(&'r mut iron::Request<'r, 'r>,)>` is not satisfied [E0277]
- src\main.rs:17 Iron::new(router).http("localhost:3000").unwrap();
- ^~~~~~~~~
- src\main.rs:17:5: 17:14 help: run `rustc --explain E0277` to see a detailed explanation
- src\main.rs:17:5: 17:14 note: required because of the requirements on the impl of `iron::Handler` for `router::Router`
- src\main.rs:17:5: 17:14 note: required by `iron::Iron::new`
- src\main.rs:17:5: 17:14 error: the trait bound `for<'r, 'r, 'r> router::Router: std::ops::FnOnce<(&'r mut iron::Request<'r, 'r>,)>` is not satisfied [E0277]
- src\main.rs:17 Iron::new(router).http("localhost:3000").unwrap();
- ^~~~~~~~~
- src\main.rs:17:5: 17:14 help: run `rustc --explain E0277` to see a detailed explanation
- src\main.rs:17:5: 17:14 note: required because of the requirements on the impl of `iron::Handler` for `router::Router`
- src\main.rs:17:5: 17:14 note: required by `iron::Iron::new`
- src\main.rs:17:23: 17:27 error: no method named `http` found for type `iron::Iron<router::Router>` in the current scope
- src\main.rs:17 Iron::new(router).http("localhost:3000").unwrap();
- ^~~~
- src\main.rs:17:23: 17:27 note: the method `http` exists but the following trait bounds were not satisfied: `router::Router : iron::Handler`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement