Struct jsonrpc::client::Client [−][src]
pub struct Client { /* fields omitted */ }
A handle to a remote JSONRPC server
Implementations
impl Client
[src]
impl Client
[src]pub fn new(url: String, user: Option<String>, pass: Option<String>) -> Client
[src]
Creates a new client
pub fn do_rpc<T: for<'a> Deserialize<'a>>(
&self,
rpc_name: &str,
args: &[Value]
) -> Result<T, Error>
[src]
&self,
rpc_name: &str,
args: &[Value]
) -> Result<T, Error>
Make a request and deserialize the response
pub fn send_request(&self, request: &Request<'_, '_>) -> Result<Response, Error>
[src]
Sends a request to a client
pub fn send_batch(
&self,
requests: &[Request<'_, '_>]
) -> Result<Vec<Option<Response>>, Error>
[src]
&self,
requests: &[Request<'_, '_>]
) -> Result<Vec<Option<Response>>, Error>
Sends a batch of requests to the client. The return vector holds the response for the request at the corresponding index. If no response was provided, it’s None.
Note that the requests need to have valid IDs, so it is advised to create the requests with [build_request].
pub fn build_request<'a, 'b>(
&self,
name: &'a str,
params: &'b [Value]
) -> Request<'a, 'b>
[src]
&self,
name: &'a str,
params: &'b [Value]
) -> Request<'a, 'b>
Builds a request
pub fn last_nonce(&self) -> u64
[src]
Accessor for the last-used nonce