Skip to content

Commit

Permalink
Fix the README example. It broke again. :(
Browse files Browse the repository at this point in the history
  • Loading branch information
tikue committed Feb 20, 2016
1 parent b777e0b commit 9193357
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ mod hello_service {
rpc hello(name: String) -> String;
}
}
use hello_service::Service as HelloService;

struct HelloService;
impl hello_service::Service for HelloService {
struct HelloServer;
impl HelloService for HelloServer {
fn hello(&self, name: String) -> String {
format!("Hello, {}!", name)
}
}

fn main() {
let server_handle = HelloService.spawn("0.0.0.0:0").unwrap();
let client = hello_service::Client::new(server_handle.local_addr(), None).unwrap();
let server_handle = HelloServer.spawn("0.0.0.0:0").unwrap();
let client = hello_service::Client::new(server_handle.local_addr()).unwrap();
assert_eq!("Hello, Mom!", client.hello("Mom".into()).unwrap());
drop(client);
server_handle.shutdown();
Expand Down

0 comments on commit 9193357

Please sign in to comment.