Attribute Macro jsonrpc_client::implement [−][src]
#[implement]
Expand description
Implement a given API trait on this client.
The client needs to have at least two fields:
- the “inner” client that is used to dispatch the request
- the “base_url” of the server the request should be sent to
If these fields are literally named inner
and base_url
, then they will be automatically detected by this macro.
If you wish to use alternative names, you can use the attributes #[jsonrpc_client(inner)]
and #[jsonrpc_client(base_url)]
to mark them accordingly.
Example
#[jsonrpc_client::implement(Math)]
struct Client {
#[jsonrpc_client(inner)]
my_client: reqwest::Client,
#[jsonrpc_client(base_url)]
url: reqwest::Url,
}