exonum_jsonrpc

Crates.ioexonum_jsonrpc
lib.rsexonum_jsonrpc
version0.5.1
sourcesrc
created_at2017-07-17 08:57:03.467371
updated_at2019-07-09 13:50:14.45213
descriptionRust support for the JSON-RPC 1.0 protocol
homepage
repositoryhttps://github.com/exonum/jsonrpc
max_upload_size
id23733
size22,027
formats (github:rustcrypto:formats)

documentation

README

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.
    }
}

Commit count: 9

cargo fmt