pub struct Transceiver(/* private fields */);Expand description
Bidirectional RPC handle. It can serve as both client and server.
Implementations§
Source§impl Transceiver
impl Transceiver
Methods from Deref<Target = 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 flush_deferred(&self) -> bool
pub fn flush_deferred(&self) -> bool
Perform flush from background task.
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
Trait Implementations§
Source§impl Clone for Transceiver
impl Clone for Transceiver
Source§fn clone(&self) -> Transceiver
fn clone(&self) -> Transceiver
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transceiver
impl Debug for Transceiver
Source§impl Deref for Transceiver
impl Deref for Transceiver
Source§impl From<Transceiver> for Sender
impl From<Transceiver> for Sender
Source§fn from(value: Transceiver) -> Self
fn from(value: Transceiver) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Transceiver
impl !RefUnwindSafe for Transceiver
impl Send for Transceiver
impl Sync for Transceiver
impl Unpin for Transceiver
impl !UnwindSafe for Transceiver
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