Struct jsonrpc::client::Client[][src]

pub struct Client { /* fields omitted */ }

A handle to a remote JSONRPC server

Implementations

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]

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]

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]

Builds a request

pub fn last_nonce(&self) -> u64[src]

Accessor for the last-used nonce

Auto Trait Implementations

impl !RefUnwindSafe for Client

impl Send for Client

impl Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any