pub struct Sender(_);Expand description
Send-only handle. This holds strong reference to the connection.
Implementations§
source§impl Sender
impl Sender
sourcepub async fn call<R: DeserializeOwned>(
&self,
method: &str,
params: &impl Serialize
) -> Result<R, CallError>
pub async fn call<R: DeserializeOwned>( &self, method: &str, params: &impl Serialize ) -> Result<R, CallError>
A shortcut for request, flush, and receive response.
sourcepub async fn call_with_err<R: DeserializeOwned, E: DeserializeOwned>(
&self,
method: &str,
params: &impl Serialize
) -> Result<R, TypedCallError<E>>
pub async fn call_with_err<R: DeserializeOwned, E: DeserializeOwned>( &self, method: &str, params: &impl Serialize ) -> Result<R, TypedCallError<E>>
A shortcut for strictly typed request
sourcepub async fn request<T: Serialize>(
&self,
method: &str,
params: &T
) -> Result<ResponseFuture<'_>, SendError>
pub async fn request<T: Serialize>( &self, method: &str, params: &T ) -> Result<ResponseFuture<'_>, SendError>
Send request, and create response future which will be resolved when the response is received.
sourcepub async fn notify<T: Serialize>(
&self,
method: &str,
params: &T
) -> Result<(), SendError>
pub async fn notify<T: Serialize>( &self, method: &str, params: &T ) -> Result<(), SendError>
Send notification message.
sourcepub fn request_deferred<T: Serialize>(
&self,
method: &str,
params: &T
) -> Result<ResponseFuture<'_>, SendError>
pub fn request_deferred<T: Serialize>( &self, method: &str, params: &T ) -> Result<ResponseFuture<'_>, SendError>
Sends a request and returns a future that will be resolved when the response is received.
This method is non-blocking, as the message writing will be deferred to the background
sourcepub fn notify_deferred<T: Serialize>(
&self,
method: &str,
params: &T
) -> Result<(), SendError>
pub fn notify_deferred<T: Serialize>( &self, method: &str, params: &T ) -> Result<(), SendError>
Send deferred notification. This method is non-blocking, as the message writing will be deferred to the background driver worker.
sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Check if the connection is disconnected.
sourcepub fn close(self) -> bool
pub fn close(self) -> bool
Closes the connection. If it’s already closed, it’ll return false.
Caution
If multiple threads calls this method at the same time, more than one thread may return true, as the close operation is lazy.
sourcepub fn is_request_enabled(&self) -> bool
pub fn is_request_enabled(&self) -> bool
Is sending request enabled?
sourcepub fn get_feature_flags(&self) -> Feature
pub fn get_feature_flags(&self) -> Feature
Get feature flags