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

pub struct Client { /* fields omitted */ }

A JSON-RPC client.

Create a new Client using one of the transport-specific constructors:

Methods

impl Client[src]

pub fn with_transport<T: Transport>(transport: T) -> Client[src]

Creates a new client with the given transport.

pub fn build_request<'a>(
    &self,
    method: &'a str,
    params: &'a [Box<RawValue>]
) -> Request<'a>
[src]

Builds a request.

To construct the arguments, one can use one of the shorthand methods [jsonrpc::arg] or [jsonrpc::try_arg].

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 call<R: for<'a> Deserialize<'a>>(
    &self,
    method: &str,
    args: &[Box<RawValue>]
) -> Result<R, Error>
[src]

Make a request and deserialize the response.

To construct the arguments, one can use one of the shorthand methods [jsonrpc::arg] or [jsonrpc::try_arg].

impl Client[src]

pub fn simple_http(
    url: &str,
    user: Option<String>,
    pass: Option<String>
) -> Result<Client, Error>
[src]

Create a new JSON-RPC client using a bare-minimum HTTP transport.

Trait Implementations

impl Debug for Client[src]

Auto Trait Implementations

impl Unpin for Client

impl Sync for Client

impl Send for Client

impl !UnwindSafe for Client

impl !RefUnwindSafe for Client

Blanket Implementations

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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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