extern crate tetsy_jsonrpc_core; extern crate tetsy_jsonrpc_core_client; #[macro_use] extern crate tetsy_jsonrpc_derive; use tetsy_jsonrpc_core::IoHandler; use tetsy_jsonrpc_core::futures::future::Future; use tetsy_jsonrpc_core_client::transports::local; #[rpc(client)] pub trait Rpc { /// Returns a protocol version #[rpc(name = "protocolVersion")] fn protocol_version(&self) -> Result; /// Adds two numbers and returns a result #[rpc(name = "add", alias("callAsyncMetaAlias"))] fn add(&self, a: u64, b: u64) -> Result; } fn main() { let fut = { let handler = IoHandler::new(); let (client, _rpc_client) = local::connect::(handler); client .add(5, 6) .map(|res| println!("5 + 6 = {}", res)) }; fut .wait() .ok(); }