1use std::vec;
2
3use rpc_toy::Client;
4
5pub fn main() {
6 let mut client = Client::new("127.0.0.1:3001").unwrap();
7 let one = serde_json::to_value(1u32).unwrap();
8 let two = serde_json::to_value(2u32).unwrap();
9 let args = vec![one, two];
10 let res = client.call("Add", &args).unwrap();
11 let three: u32 = serde_json::from_value(res.unwrap()).unwrap();
12 assert_eq!(three, 3);
13 let world = client.call("hello", &vec![]).unwrap();
14 println!(
15 "Hello, {}!",
16 serde_json::from_value::<String>(world.unwrap()).unwrap()
17 );
18 let nothing = client.call("void_fn", &vec![]).unwrap();
19 assert!(nothing.is_none());
20}