Updated examples and benchmarks for new Response representation.

This commit is contained in:
Jonathan Reem
2014-09-08 14:09:48 -07:00
parent 872dcf758c
commit 13bb07e02d
2 changed files with 18 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
#![feature(macro_rules)]
extern crate curl;
extern crate http;
extern crate hyper;
@@ -13,10 +14,19 @@ fn listen() -> hyper::server::Listening {
server.listen(handle).unwrap()
}
macro_rules! try_continue(
($e:expr) => {{
match $e {
Ok(v) => v,
Err(..) => continue
}
}})
fn handle(mut incoming: Incoming) {
for (_, mut res) in incoming {
res.write(b"Benchmarking hyper vs others!").unwrap();
res.end().unwrap();
for (_, res) in incoming {
let mut res = try_continue!(res.start());
try_continue!(res.write(b"Benchmarking hyper vs others!"))
try_continue!(res.end());
}
}