Transceiver

Struct Transceiver 

Source
pub struct Transceiver(/* private fields */);
Expand description

Bidirectional RPC handle. It can serve as both client and server.

Implementations§

Methods from Deref<Target = Sender>§

Source

pub async fn call<R: DeserializeOwned>( &self, method: &str, params: &impl Serialize, ) -> Result<R, CallError>

A shortcut for request, flush, and receive response.

Source

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

Source

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.

Source

pub async fn notify<T: Serialize>( &self, method: &str, params: &T, ) -> Result<(), SendError>

Send notification message.

Source

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

Source

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.

Source

pub fn is_disconnected(&self) -> bool

Check if the connection is disconnected.

Source

pub async fn flush(&self) -> Result<()>

Flush underlying write stream.

Source

pub fn flush_deferred(&self) -> bool

Perform flush from background task.

Source

pub fn is_request_enabled(&self) -> bool

Is sending request enabled?

Source

pub fn get_feature_flags(&self) -> Feature

Get feature flags

Trait Implementations§

Source§

impl Clone for Transceiver

Source§

fn clone(&self) -> Transceiver

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Transceiver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for Transceiver

Source§

type Target = Sender

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<Transceiver> for Sender

Source§

fn from(value: Transceiver) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UserData for T
where T: Any + Send + Sync + 'static,

Source§

fn as_any(&self) -> &(dyn Any + Send + Sync + 'static)