Trait JsonRPCClient

Source
pub trait JsonRPCClient: Sized {
    // Required method
    fn call<T>(&self, method: &str, params: &[Value]) -> Result<T, Error>
       where T: for<'a> Deserialize<'a> + DeserializeOwned + Debug;
}
Expand description

Since the workflow for jsonrpc is the same for all methods, we can implement a trait that will let us call any method on the client, and then implement the methods on any client that implements this trait.

Required Methods§

Source

fn call<T>(&self, method: &str, params: &[Value]) -> Result<T, Error>
where T: for<'a> Deserialize<'a> + DeserializeOwned + Debug,

Calls a method on the client

This should call the appropriated rpc method and return a parsed response or error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl JsonRPCClient for Client

Available on crate feature with-jsonrpc only.