[−][src]Struct jsonrpc::client::Client
A JSON-RPC client.
Create a new Client using one of the transport-specific constructors:
- [Client::simple_http] for the built-in bare-minimum HTTP transport
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]
&self,
method: &'a str,
params: &'a [Box<RawValue>]
) -> Request<'a>
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]
&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 call<R: for<'a> Deserialize<'a>>(
&self,
method: &str,
args: &[Box<RawValue>]
) -> Result<R, Error>
[src]
&self,
method: &str,
args: &[Box<RawValue>]
) -> Result<R, Error>
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]
url: &str,
user: Option<String>,
pass: Option<String>
) -> Result<Client, Error>
Create a new JSON-RPC client using a bare-minimum HTTP transport.
Trait Implementations
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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,