Crates.io | jsonrpc-async |
lib.rs | jsonrpc-async |
version | 2.0.2 |
source | src |
created_at | 2021-01-09 08:13:11.575441 |
updated_at | 2022-02-03 05:26:01.583768 |
description | Rust support for the JSON-RPC 2.0 protocol |
homepage | https://github.com/jeremyrubin/rust-jsonrpc-async/ |
repository | https://github.com/jeremyrubin/rust-jsonrpc-async/ |
max_upload_size | |
id | 335925 |
size | 52,412 |
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'
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.
}
}