5 releases (3 breaking)

Uses old Rust 2015

0.5.1 Jul 9, 2019
0.5.0 Oct 3, 2018
0.4.0 Feb 26, 2018
0.3.0 Feb 13, 2018
0.2.0 Jul 17, 2017

#70 in #json-rpc-client


Used in exonum_bitcoinrpc

CC0 license

14KB
218 lines

Rust JSONRPC 1.0 Client

Rudimentary support for sending JSONRPC 1.0 requests and receiving responses.

This library is based on rust-jsonrpc.

JSONRPC

To send a request which should retrieve the above structure, consider the following example code

#[macro_use] extern crate jsonrpc;
#[macro_use] extern crate serde_derive;
extern crate serde;

#[derive(Serialize, Deserialize)]
struct MyStruct {
    elem1: bool,
    elem2: String,
    elem3: Vec<usize>
}

fn main() {
    // The two Nones are for user/pass for authentication
    let mut client = jsonrpc::client::Client::new("example.org", None, None);
    let request = client.build_request("getmystruct", vec![]);
    match client.send_request(&request).and_then(|res| res.into_result::<MyStruct>()) {
        Ok(mystruct) => // Ok!
        Err(e) => // Not so much.
    }
}


lib.rs:

Rust JSON-RPC Library

Rust support for the JSON-RPC 1.0 protocol.

Dependencies

~23MB
~475K SLoC