use simple_jsonrpc_client::*; jsonrpc!(pub struct Rpc { pub fn get_data(&self, _id: u64) -> Option>; }); pub struct RpcClient { rpc: Rpc, } impl RpcClient { pub fn new(uri: &str) -> Self { let client = reqwest::blocking::Client::builder() .gzip(true) .timeout(::std::time::Duration::from_secs(30)) .build() .expect("reqwest client"); Self { rpc: Rpc::new(uri, client), } } pub fn get_data(&self, id: u64) -> Option> { self.rpc.get_data(id).expect("rpc call") } } fn main() { RpcClient::new("localhost"); }