jso
jsonrpc
cargo install jsonrpc
jso

jsonrpc

Rust JSONRPC library

by Andrew Poelstra

0.11.0 (see all)License:CC0-1.0
cargo install jsonrpc
Readme

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

GitHub Stars

84

LAST COMMIT

8mos ago

MAINTAINERS

1

CONTRIBUTORS

14

OPEN ISSUES

5

OPEN PRs

4
VersionTagPublished
0.11.0
3yrs ago
0.10.2
4yrs ago
0.10.1
4yrs ago
0.9.1
4yrs ago
No alternatives found
No tutorials found
Add a tutorial