async/
async.rs

1extern crate s_jsonrpc_core;
2
3use s_jsonrpc_core::*;
4use s_jsonrpc_core::futures::Future;
5
6fn main() {
7	let mut io = IoHandler::new();
8
9	io.add_msod("say_hello", |_: Params| {
10		futures::finished(Value::String("Hello World!".to_owned()))
11	});
12
13	let request = r#"{"jsonrpc": "2.0", "msod": "say_hello", "params": [42, 23], "id": 1}"#;
14	let response = r#"{"jsonrpc":"2.0","result":"hello","id":1}"#;
15
16	assert_eq!(io.handle_request(request).wait().unwrap(), Some(response.to_owned()));
17}