Struct thin_jsonrpc_client::Client
source · pub struct Client { /* private fields */ }Implementations§
source§impl Client
impl Client
sourcepub fn from_backend<S, R>(send: S, recv: R) -> (Client, ClientDriver)where
S: BackendSender,
R: BackendReceiver + 'static,
pub fn from_backend<S, R>(send: S, recv: R) -> (Client, ClientDriver)where S: BackendSender, R: BackendReceiver + 'static,
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 request<Res>(&self, call: Call<'_>) -> Result<Res, RequestError>where
Res: DeserializeOwned,
pub async fn request<Res>(&self, call: Call<'_>) -> Result<Res, RequestError>where Res: DeserializeOwned,
Make a request to the RPC server. This will return either a response or an error, and will attempt to deserialize the response into the type you’ve asked for.
sourcepub async fn notification(&self, call: Call<'_>) -> Result<(), BackendError>
pub async fn notification(&self, call: Call<'_>) -> Result<(), BackendError>
Send a notification to the RPC server. This will not return a result.
sourcepub fn incoming(&self) -> ServerNotifications
pub fn incoming(&self) -> ServerNotifications
Obtain a stream of incoming notifications from the backend that aren’t linked to any specific request.
Auto Trait Implementations§
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