jsonrpc_v2_awc 0.1.0

JSON RPC client based on awc (actix web client)
Documentation
  • Coverage
  • 10%
    1 out of 10 items documented1 out of 6 items with examples
  • Size
  • Source code size: 4.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 474.8 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 59s Average build duration of successful builds.
  • all releases: 59s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • BitFields/jsonrpc_v2_awc
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • code-cro

JSON RPC Client - Based on awc crate (actix web client)

Examples

// call to remote function `mul` taking 2 numbers, they can be u8, f32, etc
println!(
    "2 + 3 = {:?}",
    jsonrpc_v2_awc::Request::new("mul", jsonrpc_v2_awc::Params([2, 3]), 0)
        .send("http://localhost:8082/api")
        .await?
        .body()
        .await?
);

// call to remote function `timestamp` with no params, in this case params can be () or ""
println!(
    "2 + 3 = {:?}",
    jsonrpc_v2_awc::Request::new("timestamp", jsonrpc_v2_awc::Params(()), 1)
        .send("http://localhost:8082/api")
        .await?
        .body()
        .await?
);

// call to remote function `timestamp` with no params, using api_key
println!(
    "2 + 3 = {:?}",
    jsonrpc_v2_awc::Request::new("timestamp", jsonrpc_v2_awc::Params(()), 1)
        .send_with_api_key("http://localhost:8082/api", "API_KEY", "ds09ds9d-0d9s0d.xxx.yyy")
        .await?
        .body()
        .await?
);