pub struct Client { /* private fields */ }
Expand description
A JSON-RPC client. Build this by calling Client::from_backend()
and providing a suitable sender and receiver.
Implementations§
Source§impl Client
impl Client
Sourcepub fn from_backend<S, R>(send: S, recv: R) -> (Client, ClientDriver)where
S: BackendSender,
R: BackendReceiver,
pub fn from_backend<S, R>(send: S, recv: R) -> (Client, ClientDriver)where
S: BackendSender,
R: BackendReceiver,
Construct a client/driver from a BackendSender
and BackendReceiver
.
The ClientDriver
handed back is a stream which needs polling in order to
drive the message receiving.
Sourcepub async fn send_request<Params>(
&self,
method: &str,
params: Params,
) -> Result<Response, RequestError>where
Params: IntoRpcParams,
pub async fn send_request<Params>(
&self,
method: &str,
params: Params,
) -> Result<Response, RequestError>where
Params: IntoRpcParams,
Make a request to the RPC server. This will return either a response or an error.
Sourcepub async fn send_notification<Params>(
&mut self,
method: &str,
params: Params,
) -> Result<(), BackendError>where
Params: IntoRpcParams,
pub async fn send_notification<Params>(
&mut self,
method: &str,
params: Params,
) -> Result<(), BackendError>where
Params: IntoRpcParams,
Send a notification to the RPC server. This will not wait for a response.
Sourcepub fn notifications(&self) -> ServerNotifications
pub fn notifications(&self) -> ServerNotifications
Obtain a stream of server notifications from the backend that aren’t linked to any specific request.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more