Update code in readme. Haven't checked if it runs

This commit is contained in:
Tim Kuehn
2016-01-16 01:20:03 -08:00
parent 667eef4066
commit 15f2547ec7

View File

@@ -17,15 +17,16 @@ rpc! {
}
}
impl hello_service::Service for () {
struct HelloService;
impl hello_service::Service for HelloService {
fn hello(&self, name: String) -> String {
format!("Hello, {}!", s)
}
}
fn main() {
let server_handle = hello_service::serve("0.0.0.0:0", ()).unwrap();
let client = hello_service::Client::new(server_handle.local_addr()).unwrap();
let server_handle = hello_service::serve("0.0.0.0:0", HelloService, None).unwrap();
let client = hello_service::Client::new(server_handle.local_addr(), None).unwrap();
assert_eq!("Hello, Mom!".into(), client.hello("Mom".into()).unwrap());
drop(client);
server_handle.shutdown();