1 stable release

2.0.1 Jan 9, 2021

#460 in Network programming

Download history 21/week @ 2021-01-03 21/week @ 2021-01-10 10/week @ 2021-01-17 2/week @ 2021-01-24 17/week @ 2021-01-31 5/week @ 2021-02-07 81/week @ 2021-02-14 164/week @ 2021-02-21 6/week @ 2021-02-28 3/week @ 2021-03-07 3/week @ 2021-03-14 193/week @ 2021-03-21 195/week @ 2021-03-28 176/week @ 2021-04-04 12/week @ 2021-04-11 72/week @ 2021-04-18

109 downloads per month
Used in 2 crates (via bitcoincore-rpc-async)

CC0 license

44KB
873 lines

Status

Rust Version compatibility

This library is compatible with Rust 1.29.0 or higher. However, because some dependencies have increased their Rust versions in minor/patch revisions, a bit of work is required for users who wish to use older versions of the compiler. In particular,

For compatibility with older versions of rustc, use the following commands to pull your dependencies back down to unbroken versions:

cargo update --package 'serde_json' --precise '1.0.39'
cargo update --package 'serde_derive' --precise '1.0.98'

Rust JSONRPC Client

Rudimentary support for sending JSONRPC 2.0 requests and receiving responses.

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

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

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

fn main() {
    // The two Nones are for user/pass for authentication
    let rtt = jsonrpc::simple_rtt::Tripper::new();
    let client = jsonrpc::client::Client::with_rtt(rtt, "example.org".to_owned(), None, None);
    match client.do_rpc::<MyStruct>(&request) {
        Ok(mystruct) => // Ok!
        Err(e) => // Not so much.
    }
}

Dependencies

~2.9–4MB
~72K SLoC