fix(README): Update to compile example against Rust beta

Remove unused import
res doesn't need to be mutable in parameter list
Change .listen() to string format
This commit is contained in:
Martin Feckie
2015-04-04 22:58:26 +08:00
parent 4fecd64c0f
commit 341f19d326

View File

@@ -28,21 +28,20 @@ Hello World Server:
extern crate hyper;
use std::io::Write;
use std::net::Ipv4Addr;
use hyper::Server;
use hyper::server::Request;
use hyper::server::Response;
use hyper::net::Fresh;
fn hello(_: Request, mut res: Response<Fresh>) {
fn hello(_: Request, res: Response<Fresh>) {
let mut res = res.start().unwrap();
res.write_all(b"Hello World!").unwrap();
res.end().unwrap();
}
fn main() {
Server::http(hello).listen(Ipv4Addr::new(127, 0, 0, 1), 3000).unwrap();
Server::http(hello).listen("127.0.0.1:3000").unwrap();
}
```