Skip to content

Commit 527f884

Browse files
committed
Update examples
1 parent 7721ea0 commit 527f884

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/hitcounter.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use iron::prelude::*;
55

66
use persistent::Write;
77
use iron::typemap::Key;
8-
use iron::{status};
8+
use iron::StatusCode;
99

1010
#[derive(Copy, Clone)]
1111
pub struct HitCounter;
@@ -17,12 +17,12 @@ fn serve_hits(req: &mut Request) -> IronResult<Response> {
1717
let mut count = mutex.lock().unwrap();
1818

1919
*count += 1;
20-
Ok(Response::with((status::Ok, format!("Hits: {}", *count))))
20+
Ok(Response::with((StatusCode::OK, format!("Hits: {}", *count))))
2121
}
2222

2323
fn main() {
2424
let mut chain = Chain::new(serve_hits);
2525
chain.link(Write::<HitCounter>::both(0));
26-
Iron::new(chain).http("localhost:3000").unwrap();
26+
Iron::new(chain).http("localhost:3000");
2727
}
2828

examples/variable_passing.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use iron::prelude::*;
77

88
use persistent::Read;
99
use iron::typemap::Key;
10-
use iron::{status};
10+
use iron::StatusCode;
1111

1212
#[derive(Copy, Clone)]
1313
pub struct Log;
@@ -18,14 +18,14 @@ fn serve_hits(req: &mut Request) -> IronResult<Response> {
1818
let arc = req.get::<Read<Log>>().unwrap();
1919
let log_path = arc.as_ref();
2020

21-
Ok(Response::with((status::Ok, format!("Hits: {}", log_path))))
21+
Ok(Response::with((StatusCode::OK, format!("Hits: {}", log_path))))
2222
}
2323

2424
fn main() {
2525
// This can be passed from command line arguments for example.
2626
let log_path = String::from("/path/to/a/log/file.log");
2727
let mut chain = Chain::new(serve_hits);
2828
chain.link(Read::<Log>::both(log_path));
29-
Iron::new(chain).http("localhost:3000").unwrap();
29+
Iron::new(chain).http("localhost:3000");
3030
}
3131

0 commit comments

Comments
 (0)