2 stable releases

2.0.2 Feb 3, 2022
2.0.1 Jan 9, 2021

#1855 in Network programming

Download history 309/week @ 2024-07-22 255/week @ 2024-07-29 648/week @ 2024-08-05 1006/week @ 2024-08-12 582/week @ 2024-08-19 524/week @ 2024-08-26 1120/week @ 2024-09-02 644/week @ 2024-09-09 955/week @ 2024-09-16 750/week @ 2024-09-23 376/week @ 2024-09-30 662/week @ 2024-10-07 709/week @ 2024-10-14 471/week @ 2024-10-21 493/week @ 2024-10-28 1408/week @ 2024-11-04

3,110 downloads per month
Used in 12 crates (3 directly)

CC0 license

45KB
876 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

~3–9.5MB
~93K SLoC