From 8f3afae79f553e87a1059e960398adbe00d63f14 Mon Sep 17 00:00:00 2001 From: Robert Czechowski Date: Mon, 11 Feb 2019 23:49:46 +0100 Subject: [PATCH] Changes for new iron version 0.7 with hyper 0.12 --- examples/get_request.rs | 6 +++--- examples/post_request.rs | 6 +++--- src/lib.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/get_request.rs b/examples/get_request.rs index 3073da3..894dc7b 100644 --- a/examples/get_request.rs +++ b/examples/get_request.rs @@ -3,7 +3,7 @@ extern crate iron; extern crate urlencoded; use iron::prelude::*; -use iron::status; +use iron::StatusCode; use urlencoded::UrlEncodedQuery; fn log_params(req: &mut Request) -> IronResult { @@ -13,10 +13,10 @@ fn log_params(req: &mut Request) -> IronResult { Err(ref e) => println!("{:?}", e) }; - Ok(Response::with((status::Ok, "Hello!"))) + Ok(Response::with((StatusCode::OK, "Hello!"))) } // Test out the server with `curl -i "http://localhost:3000/?name=franklin&name=trevor"` fn main() { - Iron::new(log_params).http("127.0.0.1:3000").unwrap(); + Iron::new(log_params).http("127.0.0.1:3000"); } diff --git a/examples/post_request.rs b/examples/post_request.rs index 9a0dd22..4e47d0d 100644 --- a/examples/post_request.rs +++ b/examples/post_request.rs @@ -3,7 +3,7 @@ extern crate iron; extern crate urlencoded; use iron::prelude::*; -use iron::status; +use iron::StatusCode; use urlencoded::UrlEncodedBody; fn log_post_data(req: &mut Request) -> IronResult { @@ -12,10 +12,10 @@ fn log_post_data(req: &mut Request) -> IronResult { Err(ref e) => println!("{:?}", e) }; - Ok(Response::with((status::Ok, "Hello!"))) + Ok(Response::with((StatusCode::OK, "Hello!"))) } // Test with `curl -i -X POST "http://localhost:3000/" --data "fruit=apple&name=iron&fruit=pear"` fn main() { - Iron::new(log_post_data).http("127.0.0.1:3000").unwrap(); + Iron::new(log_post_data).http("127.0.0.1:3000"); } diff --git a/src/lib.rs b/src/lib.rs index 3f2e1fa..683db6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -78,7 +78,7 @@ impl Key for UrlEncodedQuery { type Value = QueryMap; } -impl<'a, 'b> plugin::Plugin> for UrlEncodedQuery { +impl plugin::Plugin for UrlEncodedQuery { type Error = UrlDecodingError; fn eval(req: &mut Request) -> QueryResult { @@ -89,7 +89,7 @@ impl<'a, 'b> plugin::Plugin> for UrlEncodedQuery { } } -impl<'a, 'b> plugin::Plugin> for UrlEncodedBody { +impl plugin::Plugin for UrlEncodedBody { type Error = UrlDecodingError; fn eval(req: &mut Request) -> QueryResult {