27 releases

0.11.0 Apr 6, 2019
0.10.2 Oct 19, 2018
0.10.0 Sep 24, 2018
0.9.0 Jul 30, 2018
0.6.2 Nov 23, 2015

#354 in Network programming

Download history 91/week @ 2018-12-22 9/week @ 2018-12-29 118/week @ 2019-01-05 96/week @ 2019-01-12 71/week @ 2019-01-19 85/week @ 2019-01-26 59/week @ 2019-02-02 64/week @ 2019-02-09 86/week @ 2019-02-16 53/week @ 2019-02-23 149/week @ 2019-03-02 157/week @ 2019-03-09 361/week @ 2019-03-16 437/week @ 2019-03-23 131/week @ 2019-03-30

623 downloads per month
Used in 5 crates (2 directly)

CC0 license

28KB
522 lines

Status

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 mut client = jsonrpc::client::Client::new("example.org".to_owned(), None, None);
    let request = client.build_request("getmystruct".to_owned(), 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 2.0 protocol.

Dependencies

~4.5MB
~95K SLoC