pub struct Client<L = RpcLogger<RpcService>> { /* private fields */ }
Available on crate features
async-client
and async-wasm-client
and client
only.Expand description
Generic asynchronous client.
Implementations§
Source§impl<L> Client<L>
impl<L> Client<L>
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Checks if the client is connected to the target.
Sourcepub async fn on_disconnect(&self) -> Error
pub async fn on_disconnect(&self) -> Error
Completes when the client is disconnected or the client’s background task encountered an error. If the client is already disconnected, the future produced by this method will complete immediately.
§Cancel safety
This method is cancel safe.
Sourcepub fn request_timeout(&self) -> Duration
pub fn request_timeout(&self) -> Duration
Returns configured request timeout.
Trait Implementations§
Source§impl<L> ClientT for Client<L>where
L: RpcServiceT<MethodResponse = Result<MiddlewareMethodResponse, Error>, BatchResponse = Result<MiddlewareBatchResponse, Error>, NotificationResponse = Result<MiddlewareNotifResponse, Error>> + Send + Sync,
impl<L> ClientT for Client<L>where
L: RpcServiceT<MethodResponse = Result<MiddlewareMethodResponse, Error>, BatchResponse = Result<MiddlewareBatchResponse, Error>, NotificationResponse = Result<MiddlewareNotifResponse, Error>> + Send + Sync,
Source§fn notification<Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Params: ToRpcParams + Send,
fn notification<Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<(), Error>> + Sendwhere
Params: ToRpcParams + Send,
Send a notification request
Source§fn request<R, Params>(
&self,
method: &str,
params: Params,
) -> impl Future<Output = Result<R, Error>> + Send
fn request<R, Params>( &self, method: &str, params: Params, ) -> impl Future<Output = Result<R, Error>> + Send
Send a method call request.
Source§fn batch_request<'a, R>(
&self,
batch: BatchRequestBuilder<'a>,
) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>> + Sendwhere
R: DeserializeOwned + 'a,
fn batch_request<'a, R>(
&self,
batch: BatchRequestBuilder<'a>,
) -> impl Future<Output = Result<BatchResponse<'a, R>, Error>> + Sendwhere
R: DeserializeOwned + 'a,
Send a batch request. Read more
Source§impl<L> SubscriptionClientT for Client<L>where
L: RpcServiceT<MethodResponse = Result<MiddlewareMethodResponse, Error>, BatchResponse = Result<MiddlewareBatchResponse, Error>, NotificationResponse = Result<MiddlewareNotifResponse, Error>> + Send + Sync,
impl<L> SubscriptionClientT for Client<L>where
L: RpcServiceT<MethodResponse = Result<MiddlewareMethodResponse, Error>, BatchResponse = Result<MiddlewareBatchResponse, Error>, NotificationResponse = Result<MiddlewareNotifResponse, Error>> + Send + Sync,
Source§fn subscribe<'a, Notif, Params>(
&self,
subscribe_method: &'a str,
params: Params,
unsubscribe_method: &'a str,
) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Send
fn subscribe<'a, Notif, Params>( &self, subscribe_method: &'a str, params: Params, unsubscribe_method: &'a str, ) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Send
Send a subscription request to the server.
The subscribe_method
and params
are used to ask for the subscription towards the
server. The unsubscribe_method
is used to close the subscription.
Source§fn subscribe_to_method<N>(
&self,
method: &str,
) -> impl Future<Output = Result<Subscription<N>, Error>> + Sendwhere
N: DeserializeOwned,
fn subscribe_to_method<N>(
&self,
method: &str,
) -> impl Future<Output = Result<Subscription<N>, Error>> + Sendwhere
N: DeserializeOwned,
Subscribe to a specific method.
Auto Trait Implementations§
impl<L = RpcLogger<RpcService>> !Freeze for Client<L>
impl<L = RpcLogger<RpcService>> !RefUnwindSafe for Client<L>
impl<L> Send for Client<L>where
L: Send,
impl<L> Sync for Client<L>where
L: Sync,
impl<L> Unpin for Client<L>where
L: Unpin,
impl<L = RpcLogger<RpcService>> !UnwindSafe for Client<L>
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