File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use iron::prelude::*;
5
5
6
6
use persistent:: Write ;
7
7
use iron:: typemap:: Key ;
8
- use iron:: { status } ;
8
+ use iron:: StatusCode ;
9
9
10
10
#[ derive( Copy , Clone ) ]
11
11
pub struct HitCounter ;
@@ -17,12 +17,12 @@ fn serve_hits(req: &mut Request) -> IronResult<Response> {
17
17
let mut count = mutex. lock ( ) . unwrap ( ) ;
18
18
19
19
* count += 1 ;
20
- Ok ( Response :: with ( ( status :: Ok , format ! ( "Hits: {}" , * count) ) ) )
20
+ Ok ( Response :: with ( ( StatusCode :: OK , format ! ( "Hits: {}" , * count) ) ) )
21
21
}
22
22
23
23
fn main ( ) {
24
24
let mut chain = Chain :: new ( serve_hits) ;
25
25
chain. link ( Write :: < HitCounter > :: both ( 0 ) ) ;
26
- Iron :: new ( chain) . http ( "localhost:3000" ) . unwrap ( ) ;
26
+ Iron :: new ( chain) . http ( "localhost:3000" ) ;
27
27
}
28
28
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use iron::prelude::*;
7
7
8
8
use persistent:: Read ;
9
9
use iron:: typemap:: Key ;
10
- use iron:: { status } ;
10
+ use iron:: StatusCode ;
11
11
12
12
#[ derive( Copy , Clone ) ]
13
13
pub struct Log ;
@@ -18,14 +18,14 @@ fn serve_hits(req: &mut Request) -> IronResult<Response> {
18
18
let arc = req. get :: < Read < Log > > ( ) . unwrap ( ) ;
19
19
let log_path = arc. as_ref ( ) ;
20
20
21
- Ok ( Response :: with ( ( status :: Ok , format ! ( "Hits: {}" , log_path) ) ) )
21
+ Ok ( Response :: with ( ( StatusCode :: OK , format ! ( "Hits: {}" , log_path) ) ) )
22
22
}
23
23
24
24
fn main ( ) {
25
25
// This can be passed from command line arguments for example.
26
26
let log_path = String :: from ( "/path/to/a/log/file.log" ) ;
27
27
let mut chain = Chain :: new ( serve_hits) ;
28
28
chain. link ( Read :: < Log > :: both ( log_path) ) ;
29
- Iron :: new ( chain) . http ( "localhost:3000" ) . unwrap ( ) ;
29
+ Iron :: new ( chain) . http ( "localhost:3000" ) ;
30
30
}
31
31
You can’t perform that action at this time.
0 commit comments