[−][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
Implementations
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 async fn send_request(
&self,
request: Request<'_>
) -> Result<Response, Error>
[src]
&self,
request: Request<'_>
) -> Result<Response, Error>
Sends a request to a client
pub async 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 async 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 async 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 !RefUnwindSafe for Client
[src]
impl Send for Client
[src]
impl Sync for Client
[src]
impl Unpin for Client
[src]
impl !UnwindSafe for Client
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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.
pub 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>,